diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2008-10-13 20:34:12 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2008-10-13 20:34:12 +0000 |
commit | 28c1518dc93984a96b373daafef1ff07c88d62fb (patch) | |
tree | f8d74df9df20bd9cb18d9ee1ed12645a73ce3633 /app/luit/luit.c | |
parent | 2b0b095090d200dbb52cedaf835e295aa928bcd3 (diff) |
luit 1.0.3
Diffstat (limited to 'app/luit/luit.c')
-rw-r--r-- | app/luit/luit.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/app/luit/luit.c b/app/luit/luit.c index 99cee82da..5c8d606b8 100644 --- a/app/luit/luit.c +++ b/app/luit/luit.c @@ -306,16 +306,12 @@ parseArgs(int argc, char **argv, char *argv0, char *shell; shell = getenv("SHELL"); if(shell) { - path = malloc(strlen(shell) + 1); - if(!path) - goto bail; - strcpy(path, shell); + path = strdup(shell); } else { - path = malloc(strlen("/bin/sh") + 1); - if(!path) - goto bail; - strcpy(path, "/bin/sh"); + path = strdup("/bin/sh"); } + if(!path) + goto bail; child_argv = malloc(2 * sizeof(char*)); if(!child_argv) goto bail; @@ -325,10 +321,9 @@ parseArgs(int argc, char **argv, char *argv0, child_argv[0] = my_basename(path); child_argv[1] = NULL; } else { - path = malloc(strlen(argv[0]) + 1); + path = strdup(argv[0]); if(!path) goto bail; - strcpy(path, argv[0]); child_argv = malloc((argc + 1) * sizeof(char*)); if(!child_argv) { goto bail; |