diff options
Diffstat (limited to 'src/process/execlp.c')
-rw-r--r-- | src/process/execlp.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/process/execlp.c b/src/process/execlp.c index 33fb0f7f..c7b3f513 100644 --- a/src/process/execlp.c +++ b/src/process/execlp.c @@ -1,18 +1,19 @@ #include <unistd.h> #include <stdarg.h> -int execlp(const char *file, ...) +int execlp(const char *file, const char *argv0, ...) { int argc; va_list ap; - va_start(ap, file); - for (argc=0; va_arg(ap, const char *); argc++); + va_start(ap, argv0); + for (argc=1; va_arg(ap, const char *); argc++); va_end(ap); { int i; char *argv[argc+1]; - va_start(ap, file); - for (i=0; i<argc; i++) + va_start(ap, argv0); + argv[0] = (char *)argv0; + for (i=1; i<argc; i++) argv[i] = va_arg(ap, char *); argv[i] = NULL; return execvp(file, argv); |