aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar minus <minus@mnus.de>2015-08-20 14:49:54 +0200
committerLibravatar minus <minus@mnus.de>2015-08-20 15:24:33 +0200
commit70f046c87a1fc03c3b3132bf3b05d2e4c4495805 (patch)
treef95563e8e1a3067b069e9db5418d21e81c83d701
parentproperly exit sway (diff)
downloadsway-70f046c87a1fc03c3b3132bf3b05d2e4c4495805.tar.gz
sway-70f046c87a1fc03c3b3132bf3b05d2e4c4495805.tar.zst
sway-70f046c87a1fc03c3b3132bf3b05d2e4c4495805.zip
set IPC client sockets to close on exec
-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 @@
10#include <stdlib.h> 10#include <stdlib.h>
11#include <stropts.h> 11#include <stropts.h>
12#include <sys/ioctl.h> 12#include <sys/ioctl.h>
13#include <fcntl.h>
13#include "ipc.h" 14#include "ipc.h"
14#include "log.h" 15#include "log.h"
15#include "config.h" 16#include "config.h"
@@ -78,6 +79,12 @@ int ipc_handle_connection(int fd, uint32_t mask, void *data) {
78 return 0; 79 return 0;
79 } 80 }
80 81
82 int flags;
83 if ((flags=fcntl(client_fd, F_GETFD)) == -1 || fcntl(client_fd, F_SETFD, flags|FD_CLOEXEC) == -1) {
84 sway_log_errno(L_INFO, "Unable to set CLOEXEC on IPC client socket");
85 return 0;
86 }
87
81 struct ipc_client* client = malloc(sizeof(struct ipc_client)); 88 struct ipc_client* client = malloc(sizeof(struct ipc_client));
82 client->payload_length = 0; 89 client->payload_length = 0;
83 client->fd = client_fd; 90 client->fd = client_fd;