summaryrefslogtreecommitdiff
path: root/bus/main.c
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2011-06-13 15:58:45 +0100
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2011-06-13 15:58:45 +0100
commit50c81a35a7c692b0e19b4a5d92343267f4a10c06 (patch)
tree48299356d47c5ba681a4a24621e3b238e64bf11f /bus/main.c
parentc5c78507621256b73e434443739584b769bb317b (diff)
downloaddbus-50c81a35a7c692b0e19b4a5d92343267f4a10c06.tar.gz
bus: signal_handler: ignore failure to write, and explain why
See the comment in the source code for rationale. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33336 Reviewed-by: Thiago Macieira <thiago@kde.org>
Diffstat (limited to 'bus/main.c')
-rw-r--r--bus/main.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/bus/main.c b/bus/main.c
index 1af588e3..136d122f 100644
--- a/bus/main.c
+++ b/bus/main.c
@@ -44,7 +44,6 @@ static int reload_pipe[2];
#define RELOAD_WRITE_END 1
static void close_reload_pipe (DBusWatch **);
-static void close_reload_pipe_write (void);
static void
signal_handler (int sig)
@@ -64,8 +63,14 @@ signal_handler (int sig)
if ((reload_pipe[RELOAD_WRITE_END] > 0) &&
!_dbus_write_socket (reload_pipe[RELOAD_WRITE_END], &str, 0, 1))
{
+ /* If we receive SIGHUP often enough to fill the pipe buffer (4096
+ * times on old Linux, 65536 on modern Linux) before it can be
+ * drained, let's just warn and ignore. The configuration will be
+ * reloaded while draining the pipe buffer, which is what we
+ * wanted. It's harmless that it will be reloaded fewer times than
+ * we asked for, since the reload is delayed anyway, so new changes
+ * will be picked up. */
_dbus_warn ("Unable to write to reload pipe.\n");
- close_reload_pipe_write ();
}
}
break;
@@ -261,13 +266,6 @@ close_reload_pipe (DBusWatch **watch)
_dbus_close_socket (reload_pipe[RELOAD_READ_END], NULL);
reload_pipe[RELOAD_READ_END] = -1;
- close_reload_pipe_write ();
-}
-
-/* this is the only bit that's safe to do from an async signal handler */
-static void
-close_reload_pipe_write (void)
-{
_dbus_close_socket (reload_pipe[RELOAD_WRITE_END], NULL);
reload_pipe[RELOAD_WRITE_END] = -1;
}