mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-05-17 03:01:58 +02:00
Use inotify_init1 when available
To avoid leaking the inotify fd. Fixes bug 585478.
This commit is contained in:
parent
4dbc2074bc
commit
8a3a3d797e
@ -1599,6 +1599,7 @@ inotify_support=no
|
|||||||
AC_CHECK_HEADERS([sys/inotify.h],
|
AC_CHECK_HEADERS([sys/inotify.h],
|
||||||
[
|
[
|
||||||
inotify_support=yes
|
inotify_support=yes
|
||||||
|
AC_CHECK_FUNCS(inotify_init1)
|
||||||
])
|
])
|
||||||
|
|
||||||
AM_CONDITIONAL(HAVE_INOTIFY, [test "$inotify_support" = "yes"])
|
AM_CONDITIONAL(HAVE_INOTIFY, [test "$inotify_support" = "yes"])
|
||||||
|
@ -187,10 +187,15 @@ gboolean _ik_startup (void (*cb)(ik_event_t *event))
|
|||||||
/* Ignore multi-calls */
|
/* Ignore multi-calls */
|
||||||
if (initialized)
|
if (initialized)
|
||||||
return inotify_instance_fd >= 0;
|
return inotify_instance_fd >= 0;
|
||||||
|
|
||||||
initialized = TRUE;
|
initialized = TRUE;
|
||||||
|
|
||||||
|
#ifdef HAVE_INOTIFY_INIT1
|
||||||
|
inotify_instance_fd = inotify_init1 (IN_CLOEXEC);
|
||||||
|
#else
|
||||||
inotify_instance_fd = inotify_init ();
|
inotify_instance_fd = inotify_init ();
|
||||||
|
#endif
|
||||||
|
|
||||||
if (inotify_instance_fd < 0)
|
if (inotify_instance_fd < 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user