Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Message-ID: <3BD3EB2F.FD7F5D38@syntrex.com> Date: Mon, 22 Oct 2001 11:47:27 +0200 From: Pavel Tsekov Organization: Syntrex Inc. X-Mailer: Mozilla 4.76 [en] (X11; U; Linux 2.4.2-2 i686) X-Accept-Language: en MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: more info on execvp problem References: <3BD3EA44 DOT FF96A58A AT syntrex DOT com> Content-Type: multipart/mixed; boundary="------------F40C2D64F76C2B90DCC6C6F8" --------------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 #include -#ifdef __CYGWIN32__ -static char path_delim; -#define PATH_DELIM path_delim -#else #define PATH_DELIM ':' -#endif /* * Copy string, until c or 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--