From: epg <> Date: Wed, 29 Mar 2006 05:09:18 +0000 (+0000) Subject: (run_processor): r1901 was a little off; this should only _exit when X-Git-Url: https://diplodocus.org/git/mdeliver/commitdiff_plain/f05e512a112bc9236499eac55764fd4343434fc6 (run_processor): r1901 was a little off; this should only _exit when the fork succeeded, and we cannot use vfork, as we need to write an error message if the exec failed. --- diff --git a/mdeliver.c b/mdeliver.c index b615950..d6e49e7 100644 --- a/mdeliver.c +++ b/mdeliver.c @@ -267,10 +267,11 @@ run_processor(char *home, char *newfn) int olderrno; int fd; - if ((pid = vfork()) > 0) { + if ((pid = fork()) > 0) { return; } else if (pid == 0) { - snprintf(command, PATH_MAX, "%s/%s", home, ".mdeliver-processor"); + snprintf(command, sizeof(command), "%s/%s", + home, ".mdeliver-processor"); execl(command, command, newfn, NULL); if (errno == ENOENT) { /* Not having a processor is not an error. */ @@ -278,7 +279,7 @@ run_processor(char *home, char *newfn) } fail = "exec"; } else { - fail = "vfork"; + fail = "fork"; } olderrno = errno; @@ -298,7 +299,9 @@ run_processor(char *home, char *newfn) close(fd); } - _exit(0); + if (fail[0] == 'e') { + _exit(0); + } } int