X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fruntime%2Frun-program.c;h=367dd77bc497042a89c8ae77a3adeb714a9da753;hb=ed1910efb36f71b5ebe33b5ffffd7195e15644de;hp=7377e7fccf3674a00d07ca9794438df33c355bb1;hpb=6cfdd9e66519b513e0935c410fbb30fc880efb61;p=sbcl.git diff --git a/src/runtime/run-program.c b/src/runtime/run-program.c index 7377e7f..367dd77 100644 --- a/src/runtime/run-program.c +++ b/src/runtime/run-program.c @@ -25,7 +25,7 @@ #include #include #include - +#include #include #include #include @@ -138,9 +138,12 @@ int spawn(char *program, char *argv[], int sin, int sout, int serr, p += n; } } + close(channel[0]); if (child_errno) { waitpid(pid, NULL, 0); - pid = 0; + /* Our convention to tell Lisp that it was the exec that + * failed, not the fork. */ + pid = -2; errno = child_errno; } } @@ -190,7 +193,9 @@ int spawn(char *program, char *argv[], int sin, int sout, int serr, if (fd != channel[1]) close(fd); #endif - environ = envp; + if (envp) { + environ = envp; + } /* Exec the program. */ if (search) execvp(program, argv);