X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=sbr%2Fexecprog.c;h=c10421d2ce4b306f7ba721106a89cc79d07ee68a;hp=6a4a912d9d2544078a10adccb7050788388b9200;hb=4112940aea5591648b03a81907408752c08b33aa;hpb=0127c00f735b9e38608676b9f7bd3c6e38a7ffb4 diff --git a/sbr/execprog.c b/sbr/execprog.c index 6a4a912..c10421d 100644 --- a/sbr/execprog.c +++ b/sbr/execprog.c @@ -4,6 +4,9 @@ */ #include +#include +#include +#include int @@ -11,28 +14,26 @@ execprog(char *cmd, char **arg) { pid_t pid; - context_save(); fflush(stdout); - switch (pid = fork()) { case -1: /* fork error */ advise("fork", "unable to"); - return 1; + return -1; case 0: /* child */ execvp(cmd, arg); fprintf(stderr, "unable to exec "); perror(cmd); - _exit(-1); + _exit(EX_OSERR); default: /* parent */ - return (pidwait(pid, -1) & 0377 ? 1 : 0); + return pidXwait(pid, cmd); } - return 1; /* NOT REACHED */ + return -1; /* NOT REACHED */ }