Mail Archives: cygwin/2001/10/22/05:48:01
--------------F40C2D64F76C2B90DCC6C6F8
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Ooops, sorry.. I forgot to attach the patch :)
Pavel Tsekov wrote:
>
> Ok, here is what I've found about the execvp problem
> I mentiond in an earlier post:
--------------F40C2D64F76C2B90DCC6C6F8
Content-Type: text/plain; charset=us-ascii;
name="execvp.c.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="execvp.c.diff"
--- execvp.c.ORIG Mon Oct 22 11:13:55 2001
+++ execvp.c Mon Oct 22 11:35:21 2001
@@ -11,12 +11,7 @@
#include <errno.h>
#include <ctype.h>
-#ifdef __CYGWIN32__
-static char path_delim;
-#define PATH_DELIM path_delim
-#else
#define PATH_DELIM ':'
-#endif
/*
* Copy string, until c or <nul> is encountered.
@@ -45,6 +40,10 @@ _DEFUN (execvp, (file, argv),
{
char *path = getenv ("PATH");
char buf[MAXNAMLEN];
+#ifdef __CYGWIN32__
+ int posix_path_len;
+ char *posix_path = 0;
+#endif
/* If $PATH doesn't exist, just pass FILE on unchanged. */
if (!path)
@@ -68,7 +67,13 @@ _DEFUN (execvp, (file, argv),
#endif
#ifdef __CYGWIN32__
- path_delim = cygwin_posix_path_list_p (path) ? ':' : ';';
+ if (strchr (path, ';'))
+ {
+ posix_path_len = cygwin_win32_to_posix_path_list_buf_size (path);
+ posix_path = (char *) malloc (posix_path_len);
+ cygwin_win32_to_posix_path_list (path, posix_path);
+ path = posix_path;
+ }
#endif
while (*path)
@@ -79,12 +84,17 @@ _DEFUN (execvp, (file, argv),
strcat (buf, "/");
strcat (buf, file);
if (execv (buf, argv) == -1 && errno != ENOENT)
- return -1;
+ break;
while (*path && *path != PATH_DELIM)
path++;
if (*path == PATH_DELIM)
path++; /* skip over delim */
}
+
+#ifdef __CYGWIN32__
+ if (posix_path)
+ free (posix_path);
+#endif
return -1;
}
--------------F40C2D64F76C2B90DCC6C6F8
Content-Type: text/plain; charset=us-ascii
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
--------------F40C2D64F76C2B90DCC6C6F8--
- Raw text -