aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Benjamin Barenblat <benjamin@barenblat.name>2012-04-21 18:50:16 -0400
committerGravatar Benjamin Barenblat <benjamin@barenblat.name>2012-04-23 16:55:17 -0400
commite88ef7db3e6e9345f0d2c989b573798bde99eaef (patch)
treea7e498606dc2efb66082e93cd821c77047e61150
parentc268a34b67cf485e3998a4d351eaec7cf2f5f1b4 (diff)
give uzbl-event-manager a good error when socket creation failsHEADmaster
Some file systems (usually networked file systems) don't support Unix domain sockets, and attempting to create them fails with an EPERM. uzbl-event-manager now checks for such failures and announces them via the logging interface, rather than simply dropping a traceback.
-rwxr-xr-xbin/uzbl-event-manager16
1 files changed, 12 insertions, 4 deletions
diff --git a/bin/uzbl-event-manager b/bin/uzbl-event-manager
index 56253ef..c9f7391 100755
--- a/bin/uzbl-event-manager
+++ b/bin/uzbl-event-manager
@@ -3,6 +3,7 @@
# Event Manager for Uzbl
# Copyright (c) 2009-2010, Mason Larobina <mason.larobina@gmail.com>
# Copyright (c) 2009, Dieter Plaetinck <dieter@plaetinck.be>
+# Copyright (c) 2012, Benjamin Barenblat <benjamin@barenblat.name>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -568,11 +569,18 @@ class UzblEventDaemon(object):
self.close_server_socket()
sock = socket(AF_UNIX, SOCK_STREAM)
- sock.bind(opts.server_socket)
- sock.listen(5)
+ try:
+ sock.bind(opts.server_socket)
+ sock.listen(5)
- self.server_socket = sock
- logger.debug('bound server socket to %r', opts.server_socket)
+ self.server_socket = sock
+ logger.debug('bound server socket to %r', opts.server_socket)
+ except socket_error:
+ if not self._quit:
+ logger.critical('could not create socket at %r',
+ opts.server_socket,
+ exc_info=True)
+ sys.exit(2)
def run(self):
'''Main event daemon loop.'''