From: "Mark E." To: djgpp-workers AT delorie DOT com Date: Fri, 9 Feb 2001 12:12:33 -0500 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Subject: Re: dosexec.c changes Message-ID: <3A83DEB1.22400.8B198A@localhost> In-reply-to: <3791-Fri09Feb2001104207+0200-eliz@is.elta.co.il> References: <3A82A9FD DOT 48 DOT 939B45 AT localhost> (snowball3 AT bigfoot DOT com) X-mailer: Pegasus Mail for Win32 (v3.12c) Reply-To: djgpp-workers AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk > This removes a chunk of code that was supposed to run files with one > of the known extensions, such as .com, .bat, .sh, etc. if they are I did go too far. Revised patch follows... Index: dosexec.c =================================================================== RCS file: /cvs/djgpp/djgpp/src/libc/dos/process/dosexec.c,v retrieving revision 1.11 diff -c -p -r1.11 dosexec.c *** dosexec.c 2000/12/25 20:33:24 1.11 --- dosexec.c 2001/02/09 17:11:58 *************** static int script_exec(const char *progr *** 1087,1092 **** --- 1087,1093 ---- int has_extension = 0, has_drive = 0; char pinterp[FILENAME_MAX]; int (*spawnfunc)(int, const char *, char *const [], char *const []); + int e = errno; f = fopen(program, "rt"); if (!f) *************** static int script_exec(const char *progr *** 1150,1156 **** --- 1151,1160 ---- } else if (__dosexec_find_on_path(interp, (char **)0, pinterp) || __dosexec_find_on_path(base, envp, pinterp)) + { spawnfunc = spawnve; /* no need to search on PATH: we've found it */ + errno = e; + } else return -1; *************** static struct { *** 1190,1196 **** { ".sed", script_exec, INTERP_FLAG_SKIP_SEARCH }, /* Sed */ { "", go32_exec, 0 }, { 0, script_exec, 0 }, /* every extension not mentioned above calls it */ ! { 0, 0 }, }; /* This is the index into the above array of the interpreter --- 1194,1200 ---- { ".sed", script_exec, INTERP_FLAG_SKIP_SEARCH }, /* Sed */ { "", go32_exec, 0 }, { 0, script_exec, 0 }, /* every extension not mentioned above calls it */ ! { 0, 0, 0 }, }; /* This is the index into the above array of the interpreter *************** int __spawnve(int mode, const char *path *** 1379,1384 **** --- 1383,1391 ---- found = 1; break; } + if (!found && access(rpath, F_OK) == 0 && + !(is_dir = (access(rpath, D_OK) == 0))) + found = 1; } if (!found) {