POSIX.1 says that argv[0] *should* be provided, but does not require it.

Handle missing argv[] values gracefully.
This commit is contained in:
Ulrich Drepper 1998-02-27 10:22:03 +00:00
parent ff8921e2f8
commit 0a54f052b5
2 changed files with 8 additions and 8 deletions

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991, 1992, 1994 Free Software Foundation, Inc.
/* Copyright (C) 1991, 1992, 1994, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@ -37,11 +37,11 @@ DEFUN(execl, (path, arg), CONST char *path AND CONST char *arg DOTS)
argv[0] = arg;
va_start (args, arg);
i = 1;
do
i = 0;
while (argv[i++] != NULL)
{
argv[i] = va_arg (args, CONST char *);
} while (argv[i++] != NULL);
}
va_end (args);
return __execve (path, (char *CONST *) argv, __environ);

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991 Free Software Foundation, Inc.
/* Copyright (C) 1991, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@ -32,11 +32,11 @@ DEFUN(execle, (path), CONST char *path AND CONST char *arg DOTS)
va_start(args, arg);
argv[0] = arg;
i = 1;
do
i = 0;
while (argv[i++] != NULL)
{
argv[i] = va_arg(args, CONST char *);
} while (argv[i++] != NULL);
}
envp = va_arg(args, CONST char *CONST *);
va_end(args);