]> diplodocus.org Git - mdeliver/commitdiff
(run_processor): r1901 was a little off; this should only _exit when
authorepg <>
Wed, 29 Mar 2006 05:09:18 +0000 (05:09 +0000)
committerepg <>
Wed, 29 Mar 2006 05:09:18 +0000 (05:09 +0000)
the fork succeeded, and we cannot use vfork, as we need to write an
error message if the exec failed.

mdeliver.c

index b615950..d6e49e7 100644 (file)
@@ -267,10 +267,11 @@ run_processor(char *home, char *newfn)
     int olderrno;
     int fd;
 
     int olderrno;
     int fd;
 
-    if ((pid = vfork()) > 0) {
+    if ((pid = fork()) > 0) {
         return;
     } else if (pid == 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. */
         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 = "exec";
     } else {
-        fail = "vfork";
+        fail = "fork";
     }
     olderrno = errno;
 
     }
     olderrno = errno;
 
@@ -298,7 +299,9 @@ run_processor(char *home, char *newfn)
         close(fd);
     }
 
         close(fd);
     }
 
-    _exit(0);
+    if (fail[0] == 'e') {
+        _exit(0);
+    }
 }
 
 int
 }
 
 int