This is the mail archive of the
newlib@sourceware.cygnus.com
mailing list for the newlib project.
patch: path search in execlp.c
- To: newlib <newlib at sourceware dot cygnus dot com>
- Subject: patch: path search in execlp.c
- From: Corinna Vinschen <corinna at vinschen dot de>
- Date: Thu, 13 Apr 2000 20:06:38 +0200
- Reply-To: newlib <newlib at sourceware dot cygnus dot com>
Hello,
if you agree, I would commit the following patch to
libc/posix/execlp.c:
While searching in the path, a slash is appended to the path
in any case before appending the file name of the executable.
This isn't correct if the path is '/' or -- generally -- if
the path ends in a slash.
The below patch cares for that case.
Regards,
Corinna
==== SNIP ====
--- execvp.c 2000/02/17 19:39:47 1.1.1.1
+++ execvp.c 2000/04/13 10:10:53
@@ -73,7 +73,7 @@ _DEFUN (execvp, (file, argv),
{
strccpy (buf, path, PATH_DELIM);
/* An empty entry means the current directory. */
- if (*buf != 0)
+ if (*buf != 0 && buf[strlen(buf) - 1] != '/')
strcat (buf, "/");
strcat (buf, file);
if (execv (buf, argv) == -1 && errno != ENOENT)
==== SNAP ====