Mail Archives: djgpp-workers/2001/02/09/12:36:05
> 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)
{
- Raw text -