|
@@ -45,6 +45,11 @@
|
|
|
#define UNIX_PATH_MAX 108
|
|
|
#endif
|
|
|
|
|
|
+
|
|
|
+#ifndef MSG_NOSIGNAL
|
|
|
+#define MSG_NOSIGNAL 0
|
|
|
+#endif
|
|
|
+
|
|
|
#define MAXMSG 1024
|
|
|
|
|
|
|
|
@@ -74,9 +79,8 @@ int main(int argc, char **argv)
|
|
|
const char *socket_path = KONFD_SOCKET_PATH;
|
|
|
|
|
|
|
|
|
- struct sigaction sig_act;
|
|
|
- sigset_t sig_set;
|
|
|
-
|
|
|
+ struct sigaction sig_act, sigpipe_act;
|
|
|
+ sigset_t sig_set, sigpipe_set;
|
|
|
|
|
|
static const char *shortopts = "hvs:";
|
|
|
#ifdef HAVE_GETOPT_H
|
|
@@ -131,6 +135,14 @@ int main(int argc, char **argv)
|
|
|
sigaction(SIGINT, &sig_act, NULL);
|
|
|
sigaction(SIGQUIT, &sig_act, NULL);
|
|
|
|
|
|
+
|
|
|
+ sigemptyset(&sigpipe_set);
|
|
|
+ sigaddset(&sigpipe_set, SIGPIPE);
|
|
|
+ sigpipe_act.sa_flags = 0;
|
|
|
+ sigpipe_act.sa_mask = sigpipe_set;
|
|
|
+ sigpipe_act.sa_handler = SIG_IGN;
|
|
|
+ sigaction(SIGPIPE, &sigpipe_act, NULL);
|
|
|
+
|
|
|
|
|
|
if ((sock = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) {
|
|
|
fprintf(stderr, "Cannot create socket: %s\n", strerror(errno));
|