Without this fix, children of i3bar would inherit the file descriptor of
the IPC connection to i3. Therefore, even if i3bar exits with SIGSEGV,
the connection to i3 stays open. Because nobody actually reads any
messages by i3, the buffer will fill up and i3 can’t deliver any more
messages, and thus busy-loops at that point.
fixes #995
* 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>
#include <string.h>
#include <err.h>
#include <stdlib.h>
+#include <unistd.h>
+#include <fcntl.h>
#include "libi3.h"
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;