From b0df72f4fbd600427553425da5be32bbd52c15e3 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Fri, 27 Feb 1998 10:19:10 +0000 Subject: Update. 1998-02-27 Ulrich Drepper * posix/execlp.c: POSIX.1 says that argv[0] *should* be provided, but does not require it. Handle missing argv[] values gracefully. * posix/execl.c: Likewise. * posix/execle.c: Likewise. --- posix/execlp.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'posix/execlp.c') diff --git a/posix/execlp.c b/posix/execlp.c index 88a54178cc..6cad6402ec 100644 --- a/posix/execlp.c +++ b/posix/execlp.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991, 1993, 1996, 1997 Free Software Foundation, Inc. +/* Copyright (C) 1991, 1993, 1996, 1997, 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 @@ -36,8 +36,8 @@ execlp (const char *file, const char *arg, ...) argv[0] = arg; va_start (args, arg); - i = 1; - do + i = 0; + while (argv[i++] != NULL) { if (i == argv_max) { @@ -59,7 +59,6 @@ execlp (const char *file, const char *arg, ...) argv[i] = va_arg (args, const char *); } - while (argv[i++] != NULL); va_end (args); return execvp (file, (char *const *) argv); -- cgit v1.2.3