--- bus/dir-watch-kqueue.c.orig 2014-01-06 17:02:19.000000000 +0100 +++ bus/dir-watch-kqueue.c 2014-05-01 16:06:22.000000000 +0200 @@ -259,7 +259,11 @@ /* FIXME - less lame error handling for failing to add a watch; * we may need to sleep. */ +#ifdef O_CLOEXEC fd = open (new_dirs[i], O_RDONLY | O_CLOEXEC); +#else + fd = open (new_dirs[i], O_RDONLY); +#endif if (fd < 0) { if (errno != ENOENT) @@ -274,6 +278,9 @@ continue; } } +#ifndef O_CLOEXEC + _dbus_fd_set_close_on_exec(fd); +#endif EV_SET (&ev, fd, EVFILT_VNODE, EV_ADD | EV_ENABLE | EV_CLEAR, NOTE_DELETE | NOTE_EXTEND | NOTE_WRITE | NOTE_RENAME, 0, 0);