From f77ee7be417492853a91e3a94c596457c2534338 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 29 Jun 2011 16:30:59 +0100 Subject: [PATCH 5/5] bus signal_handler: call _exit in the unlikely event that the pipe is full On OSs with abstract sockets, this is close enough. On OSs without abstract sockets, this results in failing to clean up Unix sockets in /tmp if someone has sent us thousands of SIGHUP signals since we last entered the main loop - I think that's acceptable. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=38656 --- bus/main.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/bus/main.c b/bus/main.c index b35ccf6..bd25feb 100644 --- a/bus/main.c +++ b/bus/main.c @@ -104,10 +104,16 @@ signal_handler (int sig) if ((reload_pipe[RELOAD_WRITE_END] > 0) && !_dbus_write_socket (reload_pipe[RELOAD_WRITE_END], &str, 0, 1)) { + /* If we can't write to the socket, dying seems a more + * important response to SIGTERM than cleaning up sockets, + * so we exit. We'd use exit(), but that's not async-signal-safe, + * so we'll have to resort to _exit(). */ static const char message[] = - "Unable to write to reload pipe - buffer full?\n"; + "Unable to write termination signal to pipe - buffer full?\n" + "Will exit instead.\n"; write (STDERR_FILENO, message, strlen (message)); + _exit (1); } } break; -- 1.7.5.4