fetchmail-friends
[Top] [All Lists]

Re: [fetchmail]problem perhaps with sink.c and pclose

2001-06-29 05:48:16
    The program assumes a 0 value for pclose else its an error.
    But as I read the man page, if the pipe has been terminated already
    and its status cannot be determined the return is -1.
    If this is true then the line at 959 - if (rc) - 
    would need to account for this possibility.

I have seen this on a Solaris 2.6 box. According to this you
shouldn't call waitpid in conjunction with pclose:

   http://www.opengroup.org/onlinepubs/7908799/xsh/pclose.html

Attached is the unsafe workaround I have for now.

Paul
--

--- sink.c~     Mon Jun 25 00:41:40 2001
+++ sink.c      Fri Jun 29 12:57:19 2001
@@ -14,6 +14,9 @@
 #include  <stdio.h>
 #include  <errno.h>
 #include  <string.h>
+#ifdef HAVE_SYS_WAIT_H
+#include <sys/wait.h>
+#endif
 #if defined(STDC_HEADERS)
 #include  <stdlib.h>
 #endif
@@ -956,12 +959,22 @@
        }
        else
            rc = 0;
-       if (rc)
+
+        if ((rc==-1) && (errno!=ECHILD))
+        {
+           report(stderr, 
+                  _("MDA exited abnormally: %d, %s\n"), errno, 
+                   strerror(errno));
+           return(FALSE);
+       }
+/*
+       if (WEXITSTATUS(rc))
        {
            report(stderr, 
-                  _("MDA exited abnormally or returned nonzero
status\n"));
+                  _("MDA returned nonzero status: %d\n"),
WEXITSTATUS(rc));
            return(FALSE);
        }
+*/
     }
     else if (ctl->bsmtp && sinkfp)
     {


____________________________________________________________
Do You Yahoo!?
Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
or your free @yahoo.ie address at http://mail.yahoo.ie


<Prev in Thread] Current Thread [Next in Thread>