]> Pileus Git - ~andy/fetchmail/commitdiff
Fix pre-/post-connect error/signal reporting.
authorMatthias Andree <matthias.andree@gmx.de>
Thu, 9 Apr 2009 20:46:39 +0000 (20:46 -0000)
committerMatthias Andree <matthias.andree@gmx.de>
Thu, 9 Apr 2009 20:46:39 +0000 (20:46 -0000)
svn path=/branches/BRANCH_6-3/; revision=5267

NEWS
driver.c
fetchmail.man

diff --git a/NEWS b/NEWS
index a86d05c0049bff9b01a6b2cda2c9a20466debbef..55c2d18ac5917f3a1248c49808f2b736bb077796 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -48,6 +48,10 @@ removed from a 6.4.0 or newer release.)
 
 fetchmail 6.3.10 (not yet released):
 
+# INCOMPATIBLE BUGFIXES
+* Use PS_PROTOCOL (4) rather than PS_SYNTAX (5) exit status when a pre- or
+  post-connect command fails.
+
 # BUGFIXES
 * Fix misuse of canonical autoconf target as _TARGET when it should have been
   _HOST. Report and patch courtesy of Diego E. "Flameeyes" Pettenò.
@@ -56,6 +60,8 @@ fetchmail 6.3.10 (not yet released):
   Michelle Konzack, Debian Bug#508667.
 * Do not overlap source and destination fields in snprintf() in interface.c.
   Courtesy of Nico Golde, Debian.
+* When a pre- or post-connect command fails, now report the exit status or
+  termination signal properly through sys/wait.h macros.
 
 # CHANGES
 * Make the comparison of the SSL fingerprints case insensitive, to
index 14cf870028ced95468b9a6e48ed00c7dcbc21a78..335da6acdfdd3599c91c56266f6bdd27896c1bf2 100644 (file)
--- a/driver.c
+++ b/driver.c
@@ -935,9 +935,13 @@ static int do_session(
        /* execute pre-initialization command, if any */
        if (ctl->preconnect && (err = system(ctl->preconnect)))
        {
-           report(stderr, 
-                  GT_("pre-connection command failed with status %d\n"), err);
-           err = PS_SYNTAX;
+           if (WIFSIGNALED(err))
+               report(stderr,
+                       GT_("pre-connection command terminated with signal %d\n"), WTERMSIG(err));
+           else
+               report(stderr,
+                       GT_("pre-connection command failed with status %d\n"), WEXITSTATUS(err));
+           err = PS_PROTOCOL;
            goto closeUp;
        }
 
@@ -1566,9 +1570,12 @@ closeUp:
     /* execute wrapup command, if any */
     if (ctl->postconnect && (tmperr = system(ctl->postconnect)))
     {
-       report(stderr, GT_("post-connection command failed with status %d\n"), tmperr);
+       if (WIFSIGNALED(tmperr))
+           report(stderr, GT_("post-connection command terminated with signal %d\n"), WTERMSIG(tmperr));
+       else
+           report(stderr, GT_("post-connection command failed with status %d\n"), WEXITSTATUS(tmperr));
        if (err == PS_SUCCESS)
-           err = PS_SYNTAX;
+           err = PS_PROTOCOL;
     }
 
     set_timeout(0); /* cancel any pending alarm */
index f623498519a5302c84b87dfa2cb6ae18a0e5cdc3..e66da7d003284d87a488fd74d7f278cf1bb8a98d 100644 (file)
@@ -2532,10 +2532,14 @@ tried to run fetchmail under circumstances where it did not have
 standard input attached to a terminal and could not prompt for a
 missing password.
 .IP 4
-Some sort of fatal protocol error was detected.
+Some sort of fatal protocol error was detected. Since 6.3.10, this
+includes non-zero exit status or signal-triggered termination of a pre-
+or post-connect command.
 .IP 5
 There was a syntax error in the arguments to
 .IR fetchmail .
+Up to and including 6.3.9, this was also used if the pre- or
+post-connect command failed.
 .IP 6
 The run control file had bad permissions.
 .IP 7