From e88ef7db3e6e9345f0d2c989b573798bde99eaef Mon Sep 17 00:00:00 2001 From: Benjamin Barenblat Date: Sat, 21 Apr 2012 18:50:16 -0400 Subject: give uzbl-event-manager a good error when socket creation fails 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. --- bin/uzbl-event-manager | 16 ++++++++++++---- 1 file 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 # Copyright (c) 2009, Dieter Plaetinck +# Copyright (c) 2012, Benjamin Barenblat # # 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.''' -- cgit v1.2.3