swc

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.nihaljere.xyz/swc
Log | Files | Refs | README | LICENSE

commit 3d0a76b52cdc067c43094b2d4ac3935e3e3dc704
parent f9bcaf911a9cbd134210aa17d8baedc5886500b4
Author: Michael Forney <mforney@mforney.org>
Date:   Sat, 30 Apr 2016 15:12:08 -0700

Unset launch socket environment var, and make the fd CLOEXEC

Diffstat:
Mlibswc/launch.c | 7+++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/libswc/launch.c b/libswc/launch.c @@ -27,6 +27,7 @@ #include "launch/protocol.h" #include "util.h" +#include <fcntl.h> #include <unistd.h> #include <wayland-server.h> @@ -72,12 +73,14 @@ launch_initialize(void) return false; launch.socket = strtol(socket_string, &end, 10); - if (*end != '\0') return false; - launch.source = wl_event_loop_add_fd(swc.event_loop, launch.socket, WL_EVENT_READABLE, &handle_data, NULL); + unsetenv(SWC_LAUNCH_SOCKET_ENV); + if (fcntl(launch.socket, F_SETFD, FD_CLOEXEC) < 0) + return false; + launch.source = wl_event_loop_add_fd(swc.event_loop, launch.socket, WL_EVENT_READABLE, &handle_data, NULL); if (!launch.source) return false;