Merge branch 'fix-ipc-fd'

This commit is contained in:
Michael Stapelberg 2013-04-14 10:14:51 +02:00
commit 9a91eb83c2
1 changed files with 5 additions and 1 deletions

View File

@ -2,7 +2,7 @@
* vim:ts=4:sw=4:expandtab * vim:ts=4:sw=4:expandtab
* *
* i3 - an improved dynamic tiling window manager * 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> #include <sys/types.h>
@ -11,6 +11,8 @@
#include <string.h> #include <string.h>
#include <err.h> #include <err.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include "libi3.h" #include "libi3.h"
@ -24,6 +26,8 @@ int ipc_connect(const char *socket_path) {
if (sockfd == -1) if (sockfd == -1)
err(EXIT_FAILURE, "Could not create socket"); err(EXIT_FAILURE, "Could not create socket");
(void)fcntl(sockfd, F_SETFD, FD_CLOEXEC);
struct sockaddr_un addr; struct sockaddr_un addr;
memset(&addr, 0, sizeof(struct sockaddr_un)); memset(&addr, 0, sizeof(struct sockaddr_un));
addr.sun_family = AF_LOCAL; addr.sun_family = AF_LOCAL;