bus signal_handler: comment why it's OK if the reload pipe gets full
authorSimon McVittie <simon.mcvittie@collabora.co.uk>
Wed, 29 Jun 2011 15:25:08 +0000 (16:25 +0100)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>
Fri, 5 Aug 2011 13:39:27 +0000 (14:39 +0100)
Backported to dbus-1.4, originally part of commit c7ef3ead558e147.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33336
Reviewed-by: Thiago Macieira <thiago@kde.org>
bus/main.c

index 59f3e7d0e24050cefbb52af422c8722b009f0eb5..b35ccf627e5e55987fca6833ae39148b09674806 100644 (file)
@@ -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";