]> git.donarmstrong.com Git - deb_pkgs/spamass-milter.git/commitdiff
Fix zombies which were happening with -x. (closes: #575019)
authordon <don@8f7917da-ec0b-0410-a553-b9b0e350d17e>
Mon, 22 Mar 2010 21:39:30 +0000 (21:39 +0000)
committerdon <don@8f7917da-ec0b-0410-a553-b9b0e350d17e>
Mon, 22 Mar 2010 21:39:30 +0000 (21:39 +0000)
debian/changelog
spamass-milter.cpp

index a7105864d01ab2aad88873dea5c1542d92aeb992..05a370d542bdb98e1299d4174e66e8bde48d0e64 100644 (file)
@@ -1,3 +1,9 @@
+spamass-milter (0.3.1-10) unstable; urgency=low
+
+  * Fix zombies which were happening with -x. (closes: #575019)
+
+ -- Don Armstrong <don@debian.org>  Mon, 22 Mar 2010 14:39:12 -0700
+
 spamass-milter (0.3.1-9) unstable; urgency=high
 
   * Call restorecon on the socket and pidfile directories to make SELinux
index 65657c193021b13020da2e3c69a5cda7935a1f63..b88987152d46ef738dc62fd9998bf0cc7f15b76e 100644 (file)
@@ -183,6 +183,7 @@ main(int argc, char* argv[])
    bool dofork = false;
    char *pidfilename = NULL;
    FILE *pidfile = NULL;
+   struct sigaction children_sigaction;
 
 #ifdef HAVE_VERBOSE_TERMINATE_HANDLER
        std::set_terminate (__gnu_cxx::__verbose_terminate_handler);
@@ -345,6 +346,13 @@ main(int argc, char* argv[])
       if (stat(sock,&junk) == 0) unlink(sock);
    }
 
+   /* We don't care about any of our children, so ignore all of them */
+   /* Set up sigaction to avoid having to reap children */
+   memset(&children_sigaction, 0, sizeof children_sigaction);
+   children_sigaction.sa_flags = SA_NOCLDWAIT;
+   sigaction(SIG_CHLD,&children_sigaction,0);
+
+
    (void) smfi_setconn(sock);
        if (smfi_register(smfilter) == MI_FAILURE) {
                fprintf(stderr, "smfi_register failed\n");
@@ -2131,6 +2139,8 @@ FILE *popenv(char *const argv[], const char *type)
        FILE *iop;
        int pdes[2];
        int save_errno;
+       pid_t pid;
+
        if ((*type != 'r' && *type != 'w') || type[1])
        {
                errno = EINVAL;
@@ -2138,7 +2148,9 @@ FILE *popenv(char *const argv[], const char *type)
        }
        if (pipe(pdes) < 0)
                return (NULL);
-       switch (fork()) {
+       
+       pid = fork();
+       switch (pid) {
        
        case -1:                        /* Error. */
                save_errno = errno;