DBusList *link;
int i, j, fd;
struct kevent ev;
+#ifdef O_CLOEXEC
+ dbus_bool_t cloexec_done = 0;
+#endif
if (!_init_kqueue (context))
goto out;
/* 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);
+ cloexec_done = (fd >= 0);
+
+ if (fd < 0 && errno == EINVAL)
+#endif
+ {
+ fd = open (new_dirs[i], O_RDONLY);
+ }
if (fd < 0)
{
if (errno != ENOENT)
continue;
}
}
+#ifdef O_CLOEXEC
+ if (!cloexec_done)
+#endif
+ {
+ _dbus_fd_set_close_on_exec (fd);
+ }
EV_SET (&ev, fd, EVFILT_VNODE, EV_ADD | EV_ENABLE | EV_CLEAR,
NOTE_DELETE | NOTE_EXTEND | NOTE_WRITE | NOTE_RENAME, 0, 0);