aboutsummaryrefslogtreecommitdiff
path: root/sway
diff options
context:
space:
mode:
authorminus <minus@mnus.de>2015-08-20 14:49:54 +0200
committerminus <minus@mnus.de>2015-08-20 15:24:33 +0200
commit70f046c87a1fc03c3b3132bf3b05d2e4c4495805 (patch)
treef95563e8e1a3067b069e9db5418d21e81c83d701 /sway
parent91c08772645e2162015c3acf8a8ae7187502adb4 (diff)
set IPC client sockets to close on exec
Diffstat (limited to 'sway')
-rw-r--r--sway/ipc.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/sway/ipc.c b/sway/ipc.c
index a6c4eb1a..69f4a4f3 100644
--- a/sway/ipc.c
+++ b/sway/ipc.c
@@ -10,6 +10,7 @@
#include <stdlib.h>
#include <stropts.h>
#include <sys/ioctl.h>
+#include <fcntl.h>
#include "ipc.h"
#include "log.h"
#include "config.h"
@@ -78,6 +79,12 @@ int ipc_handle_connection(int fd, uint32_t mask, void *data) {
return 0;
}
+ int flags;
+ if ((flags=fcntl(client_fd, F_GETFD)) == -1 || fcntl(client_fd, F_SETFD, flags|FD_CLOEXEC) == -1) {
+ sway_log_errno(L_INFO, "Unable to set CLOEXEC on IPC client socket");
+ return 0;
+ }
+
struct ipc_client* client = malloc(sizeof(struct ipc_client));
client->payload_length = 0;
client->fd = client_fd;