dbus, lua: set CLOEXEC on fds

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-08-27 10:00:10 +02:00
parent 070155d4a9
commit 608b2e2647
3 changed files with 9 additions and 2 deletions

View File

@ -438,5 +438,5 @@ awful.hooks.unmarked.register(hook_unmarked)
awful.hooks.manage.register(hook_manage) awful.hooks.manage.register(hook_manage)
awful.hooks.mouseover.register(hook_mouseover) awful.hooks.mouseover.register(hook_mouseover)
awful.hooks.arrange.register(hook_arrange) awful.hooks.arrange.register(hook_arrange)
awful.hooks.timer.register(1, hook_timer) -- awful.hooks.timer.register(1, hook_timer)
-- }}} -- }}}

4
dbus.c
View File

@ -24,6 +24,8 @@
#include <ev.h> #include <ev.h>
#include <dbus/dbus.h> #include <dbus/dbus.h>
#include <unistd.h>
#include <fcntl.h>
#include "dbus.h" #include "dbus.h"
#include "widget.h" #include "widget.h"
@ -163,6 +165,8 @@ a_dbus_init(void)
return false; return false;
} }
fcntl(fd, F_SETFD, FD_CLOEXEC);
ev_io_init(&dbusio, a_dbus_process_requests, fd, EV_READ); ev_io_init(&dbusio, a_dbus_process_requests, fd, EV_READ);
ev_io_start(EV_DEFAULT_UC_ &dbusio); ev_io_start(EV_DEFAULT_UC_ &dbusio);
ev_unref(EV_DEFAULT_UC); ev_unref(EV_DEFAULT_UC);

5
lua.c
View File

@ -26,6 +26,8 @@
#include <unistd.h> #include <unistd.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <unistd.h>
#include <fcntl.h>
#include <ev.h> #include <ev.h>
@ -765,8 +767,9 @@ luaA_cs_init(void)
{ {
int csfd = socket_getclient(); int csfd = socket_getclient();
if (csfd < 0) if (csfd < 0 || fcntl(csfd, F_SETFD, FD_CLOEXEC) == -1)
return; return;
addr = socket_getaddr(getenv("DISPLAY")); addr = socket_getaddr(getenv("DISPLAY"));
if(bind(csfd, (const struct sockaddr *) addr, SUN_LEN(addr))) if(bind(csfd, (const struct sockaddr *) addr, SUN_LEN(addr)))