tag 226462 +patch
thanks

Hi,

there was a small error in my fix: of course, (posix.WEXITSTATUS(e) >> 8)
is bogus and needs to be just posix.WEXITSTATUS(e).

Anyway, here's the patch. You might want to de-NMU the changelog entry. ;-)

diff -u gnupginterface-0.3.2/debian/changelog 
gnupginterface-0.3.2/debian/changelog
--- gnupginterface-0.3.2/debian/changelog
+++ gnupginterface-0.3.2/debian/changelog
@@ -1,0 +1,7 @@
+gnupginterface (0.3.2-4.1) unstable; urgency=low
+
+  * NMU.
+  * Fix error reporting if/when gnupg dies. (Closes: #226462)
+
+ -- Matthias Urlichs <[EMAIL PROTECTED]>  Fri, 18 Mar 2005 09:47:45 +0100
+
only in patch2:
unchanged:
--- gnupginterface-0.3.2.orig/GnuPGInterface.py
+++ gnupginterface-0.3.2/GnuPGInterface.py
@@ -223,6 +223,7 @@
 import os
 import sys
 import fcntl
+import posix
 
 __author__   = "Frank J. Tobin, [EMAIL PROTECTED]"
 __version__  = "0.3.2"
@@ -635,8 +636,17 @@
         Will raise an IOError if the process exits non-zero."""
         
         e = os.waitpid(self.pid, 0)[1]
-        if e != 0:
-            raise IOError, "GnuPG exited non-zero, with code %d" % (e << 8)
+
+        if posix.WIFSIGNALED(e):
+            raise IOError, "GnuPG died with signal %d" % posix.WTERMSIG(e)
+        elif posix.WIFEXITED(e):
+            if posix.WEXITSTATUS(e) != 0:
+                raise IOError, "GnuPG exited non-zero, with code %d" \
+                    % posix.WEXITSTATUS(e)
+        else:
+            raise IOError, "GnuPG exited with unknown status %d" % e
+
+
 
 def _run_doctests():
     import doctest, GnuPGInterface
-- 
Matthias Urlichs   |   {M:U} IT Design @ m-u-it.de   |  [EMAIL PROTECTED]

Attachment: signature.asc
Description: Digital signature

Reply via email to