Rev 129: block SIGPIPE in the daemon to prevent a SIGPIPE on write
to a dead socket in http://samba.org/~tridge/ctdb
tridge at samba.org
tridge at samba.org
Tue Apr 17 05:33:21 GMT 2007
------------------------------------------------------------
revno: 129
revision-id: tridge at samba.org-20070417053320-24de1716550f0cd1
parent: tridge at samba.org-20070417053249-780b8b0319475cef
committer: Andrew Tridgell <tridge at samba.org>
branch nick: tridge
timestamp: Tue 2007-04-17 15:33:20 +1000
message:
block SIGPIPE in the daemon to prevent a SIGPIPE on write to a dead socket
modified:
common/ctdb_daemon.c ctdb_daemon.c-20070409200331-3el1kqgdb9m4ib0g-1
=== modified file 'common/ctdb_daemon.c'
--- a/common/ctdb_daemon.c 2007-04-17 04:52:51 +0000
+++ b/common/ctdb_daemon.c 2007-04-17 05:33:20 +0000
@@ -25,6 +25,7 @@
#include "lib/util/dlinklist.h"
#include "system/network.h"
#include "system/filesys.h"
+#include "system/wait.h"
#include "../include/ctdb.h"
#include "../include/ctdb_private.h"
@@ -47,6 +48,18 @@
fcntl(fd, F_SETFL, v | O_NONBLOCK);
}
+static void block_signal(int signum)
+{
+ struct sigaction act;
+
+ memset(&act, 0, sizeof(act));
+
+ act.sa_handler = SIG_IGN;
+ sigemptyset(&act.sa_mask);
+ sigaddset(&act.sa_mask, signum);
+ sigaction(signum, &act, NULL);
+}
+
/*
structure describing a connected client in the daemon
@@ -558,6 +571,8 @@
return 0;
}
+ block_signal(SIGPIPE);
+
/* ensure the socket is deleted on exit of the daemon */
domain_socket_name = talloc_strdup(talloc_autofree_context(), ctdb->daemon.name);
talloc_set_destructor(domain_socket_name, unlink_destructor);
More information about the samba-cvs
mailing list