commit 70bb6cbc5837b1fcb11ac6f751350db469ac95df Author: David Fifield david@bamsoftware.com Date: Thu Sep 20 07:40:15 2012 -0700
Fix error handling for key and password file reading.
The finally code was trying to close a file that had not been successfully opened. --- facilitator/facilitator-email-poller | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/facilitator/facilitator-email-poller b/facilitator/facilitator-email-poller index 77f81e0..e3f3053 100755 --- a/facilitator/facilitator-email-poller +++ b/facilitator/facilitator-email-poller @@ -155,12 +155,12 @@ if options.password_filename is None: sys.exit(1) try: password_file = open(options.password_filename) -except OSError, e: +except Exception, e: print >> sys.stderr, """\ Failed to open password file "%s": %s.\ """ % (options.password_filename, str(e)) sys.exit(1) -else: +try: if not check_perms(password_file.fileno()): print >> sys.stderr, "Refusing to run with group- or world-readable password file. Try" print >> sys.stderr, "\tchmod 600 %s" % options.password_filename @@ -175,12 +175,12 @@ if options.key_filename is None: sys.exit(1) try: key_file = open(options.key_filename) -except OSError, e: +except Exception, e: print >> sys.stderr, """\ Failed to open private key file "%s": %s.\ """ % (options.key_filename, str(e)) sys.exit(1) -else: +try: if not check_perms(key_file.fileno()): print >> sys.stderr, "Refusing to run with group- or world-readable private key file. Try" print >> sys.stderr, "\tchmod 600 %s" % options.key_filename
tor-commits@lists.torproject.org