mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-26 05:56:14 +01: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],
|
||||
[
|
||||
inotify_support=yes
|
||||
AC_CHECK_FUNCS(inotify_init1)
|
||||
])
|
||||
|
||||
AM_CONDITIONAL(HAVE_INOTIFY, [test "$inotify_support" = "yes"])
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user