Use inotify_init1 when available

To avoid leaking the inotify fd. Fixes bug 585478.
This commit is contained in:
Matthias Clasen 2009-06-14 22:26:52 -04:00
parent 4dbc2074bc
commit 8a3a3d797e
2 changed files with 8 additions and 2 deletions

View File

@ -1599,6 +1599,7 @@ inotify_support=no
AC_CHECK_HEADERS([sys/inotify.h],
[
inotify_support=yes
AC_CHECK_FUNCS(inotify_init1)
])
AM_CONDITIONAL(HAVE_INOTIFY, [test "$inotify_support" = "yes"])

View File

@ -187,10 +187,15 @@ gboolean _ik_startup (void (*cb)(ik_event_t *event))
/* Ignore multi-calls */
if (initialized)
return inotify_instance_fd >= 0;
initialized = TRUE;
#ifdef HAVE_INOTIFY_INIT1
inotify_instance_fd = inotify_init1 (IN_CLOEXEC);
#else
inotify_instance_fd = inotify_init ();
#endif
if (inotify_instance_fd < 0)
return FALSE;