]> git.sur5r.net Git - i3/i3/commitdiff
Merge branch 'fix-ipc-fd'
authorMichael Stapelberg <michael@stapelberg.de>
Sun, 14 Apr 2013 08:14:51 +0000 (10:14 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Sun, 14 Apr 2013 08:14:51 +0000 (10:14 +0200)
libi3/ipc_connect.c

index 44ff7056e4cb9b0766d9e76a71a8fd280fc072ac..d27e04678e0e50c511addf5b2c8639181227ed04 100644 (file)
@@ -2,7 +2,7 @@
  * vim:ts=4:sw=4:expandtab
  *
  * i3 - an improved dynamic tiling window manager
- * © 2009-2011 Michael Stapelberg and contributors (see also: LICENSE)
+ * © 2009-2013 Michael Stapelberg and contributors (see also: LICENSE)
  *
  */
 #include <sys/types.h>
@@ -11,6 +11,8 @@
 #include <string.h>
 #include <err.h>
 #include <stdlib.h>
+#include <unistd.h>
+#include <fcntl.h>
 
 #include "libi3.h"
 
@@ -24,6 +26,8 @@ int ipc_connect(const char *socket_path) {
     if (sockfd == -1)
         err(EXIT_FAILURE, "Could not create socket");
 
+    (void)fcntl(sockfd, F_SETFD, FD_CLOEXEC);
+
     struct sockaddr_un addr;
     memset(&addr, 0, sizeof(struct sockaddr_un));
     addr.sun_family = AF_LOCAL;