author | Sebastian Harl <sh@tokkee.org> | |
Thu, 1 May 2008 23:13:24 +0000 (01:13 +0200) | ||
committer | Florian Forster <octo@huhu.verplant.org> | |
Tue, 6 May 2008 12:23:55 +0000 (14:23 +0200) | ||
commit | 3ac843c7529bb0b548d0940f081c07f6f73822c0 | |
tree | b3df765371616f7d197c681a6e30a03b38c07ceb | tree | snapshot |
parent | 6b93a8f0ade39c344013e11d3f8ae636e2930324 | commit | diff |
daemon: Ignore SIGPIPE.
The default action for the PIPE signal is to terminate the process. This
is not really what we want for collectd, as e.g. a client of the unixsock
plugin (which might even be running without root privileges) could kill
the daemon by closing the socket right after sending a request.
The signal now gets ignored and each I/O function is checked for success.
To simply that, the unixsock's output stream is now configured to be line
buffered, removing the need to call fflush() (which could fail as well and
would have to be checked for success).
While I was at it, I renamed the sigaction struct for SIGCHLD to fit the
coding style used elsewhere in collectd.
Signed-off-by: Sebastian Harl <sh@tokkee.org>
Signed-off-by: Florian Forster <octo@huhu.verplant.org>
The default action for the PIPE signal is to terminate the process. This
is not really what we want for collectd, as e.g. a client of the unixsock
plugin (which might even be running without root privileges) could kill
the daemon by closing the socket right after sending a request.
The signal now gets ignored and each I/O function is checked for success.
To simply that, the unixsock's output stream is now configured to be line
buffered, removing the need to call fflush() (which could fail as well and
would have to be checked for success).
While I was at it, I renamed the sigaction struct for SIGCHLD to fit the
coding style used elsewhere in collectd.
Signed-off-by: Sebastian Harl <sh@tokkee.org>
Signed-off-by: Florian Forster <octo@huhu.verplant.org>