summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@sun.com>2007-05-14 19:04:24 -0700
committerAlan Coopersmith <alan.coopersmith@sun.com>2007-05-14 19:04:24 -0700
commitf749d926bd9796badee2efd1ee1da5905d6fd38d (patch)
tree4e3e38febb7dab907003f0d588c28b43ae657e00
parent1a142e8b29113bbd9daf21b8371f1572cd0152dd (diff)
downloadiceauth-f749d926bd9796badee2efd1ee1da5905d6fd38d.tar.gz
Replace copystring() with strdup() calls
Also solves Coverity #924: Function copystring: Pointer "src" dereferenced before NULL check
-rw-r--r--process.c14
1 files changed, 1 insertions, 13 deletions
diff --git a/process.c b/process.c
index c235cb9..aab8882 100644
--- a/process.c
+++ b/process.c
@@ -83,7 +83,6 @@ static char *stdout_filename = "(stdout)"; /* for messages */
static char *Yes = "yes"; /* for messages */
static char *No = "no"; /* for messages */
-static char *copystring ( char *src );
static int binaryEqual ( char *a, char *b, unsigned len );
static void prefix ( char *fn, int n );
static void badcommandline ( char *cmd );
@@ -230,18 +229,7 @@ static int original_umask = 0; /* for restoring */
* private utility procedures
*/
-static char *copystring (src)
- char *src;
-{
- int len = strlen (src);
- char *cp;
-
- if (!src) return NULL;
- cp = malloc (len + 1);
- if (cp)
- strcpy (cp, src);
- return cp;
-}
+#define copystring(s) ( s != NULL ? strdup(s) : NULL )
static int
binaryEqual (a, b, len)