sjg@sun0.melb.bull.oz.au (Simon J. Gerraty) (10/05/90)
Some UNIX systems cannot handle exec'ing a shell script.
These are usually the same systems whose shell's do not grok #!/bin/sh
The following simple patch, handles the case where execl fails due to ENOEXEC
and simply punts the thing to /bin/sh to try.
*** spawn.c~1~ Thu Oct 4 14:34:50 1990
--- spawn.c Thu Oct 4 15:09:14 1990
***************
*** 164,169 ****
--- 164,175 ----
}
execl(path, name, flag, (char *) NULL);
+ /*
+ * 90-10-04 <sjg@melb.bull.oz.au>
+ * stupid exec()'s barf trying to exec a shell script!
+ */
+ if (errno == ENOEXEC)
+ execl("/bin/sh", "-c", path, flag, (char *) NULL);
fprintf(stderr, "spawn: execl ");
perror(path);
_exit(-1); /* Error */
--
Simon J. Gerraty <sjg@sun0.melb.bull.oz.au>
#include <disclaimer> /* imagine something *very* witty here */
eggert@twinsun.com (Paul Eggert) (10/07/90)
sjg@sun0.melb.bull.oz.au (Simon J. Gerraty) writes: >+ execl("/bin/sh", "-c", path, flag, (char *) NULL); Surely the ``"-c",'' is mistaken.