]> diplodocus.org Git - mdeliver/commitdiff
Yikes. run_processor was having the child return back to main if exec
authorepg <>
Tue, 28 Mar 2006 23:23:04 +0000 (23:23 +0000)
committerepg <>
Tue, 28 Mar 2006 23:23:04 +0000 (23:23 +0000)
fails.  Fix that, and switch to vfork.

mdeliver.c

index 3c8acf8..1b741e1 100644 (file)
@@ -276,18 +276,18 @@ run_processor(char *home, char *newfn)
     int olderrno;
     int fd;
 
     int olderrno;
     int fd;
 
-    if ((pid = fork()) > 0) {
+    if ((pid = vfork()) > 0) {
         return;
     } else if (pid == 0) {
         snprintf(command, PATH_MAX, "%s/%s", home, ".mdeliver-processor");
         execl(command, command, newfn, NULL);
         if (errno == ENOENT) {
             /* Not having a processor is not an error. */
         return;
     } else if (pid == 0) {
         snprintf(command, PATH_MAX, "%s/%s", home, ".mdeliver-processor");
         execl(command, command, newfn, NULL);
         if (errno == ENOENT) {
             /* Not having a processor is not an error. */
-            return;
+            _exit(0);
         }
         fail = "exec";
     } else {
         }
         fail = "exec";
     } else {
-        fail = "fork";
+        fail = "vfork";
     }
     olderrno = errno;
 
     }
     olderrno = errno;
 
@@ -306,6 +306,8 @@ run_processor(char *home, char *newfn)
         fsync(fd);
         close(fd);
     }
         fsync(fd);
         close(fd);
     }
+
+    _exit(0);
 }
 
 int
 }
 
 int