From eae369a0a9de88ea338388630a3af26958d0a410 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 29 Jun 2011 16:25:08 +0100 Subject: [PATCH 4/5] bus signal_handler: comment why it's OK if the reload pipe gets full Backported to dbus-1.4, originally part of commit c7ef3ead558e147. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33336 Reviewed-by: Thiago Macieira --- bus/main.c | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-) diff --git a/bus/main.c b/bus/main.c index 59f3e7d..b35ccf6 100644 --- a/bus/main.c +++ b/bus/main.c @@ -74,6 +74,19 @@ 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. + * + * We use write() because _dbus_warn uses vfprintf, which isn't + * async-signal-safe. + * + * This is necessarily Unix-specific, but so are POSIX signals, + * so... */ static const char message[] = "Unable to write to reload pipe - buffer full?\n"; -- 1.7.5.4