]> arthur.barton.de Git - bup.git/commitdiff
cmd/daemon: correctly report socket binding/listening errors.
authorAvery Pennarun <apenwarr@gmail.com>
Sun, 13 Feb 2011 10:17:31 +0000 (02:17 -0800)
committerAvery Pennarun <apenwarr@gmail.com>
Sun, 13 Feb 2011 13:02:21 +0000 (05:02 -0800)
We should never, ever throw away the string from an exception, because
that's how people debug problems.  (In this case, my problem was "address
already in use.")

Signed-off-by: Avery Pennarun <apenwarr@gmail.com>
cmd/daemon-cmd.py

index d61e35d782e7f72d927bef0cac589820b05c8f3b..715b656c8542b3927dabfcbfe5501dfb40e9080e 100755 (executable)
@@ -21,12 +21,13 @@ import socket
 import sys
 
 socks = []
+e = None
 for res in socket.getaddrinfo(host, port, socket.AF_UNSPEC,
                               socket.SOCK_STREAM, 0, socket.AI_PASSIVE):
     af, socktype, proto, canonname, sa = res
     try:
         s = socket.socket(af, socktype, proto)
-    except socket.error, msg:
+    except socket.error, e:
         continue
     try:
         if af == socket.AF_INET6:
@@ -35,13 +36,13 @@ for res in socket.getaddrinfo(host, port, socket.AF_UNSPEC,
             log("bup daemon: listening on %s:%s\n" % sa[:2])
         s.bind(sa)
         s.listen(1)
-    except socket.error, msg:
+    except socket.error, e:
         s.close()
         continue
     socks.append(s)
 
 if not socks:
-    log('bup daemon: could not open socket\n')
+    log('bup daemon: listen socket: %s\n' % e.args[1])
     sys.exit(1)
 
 try: