Support inotify on older kernels
authorColin Walters <walters@verbum.org>
Tue, 16 Mar 2010 16:16:33 +0000 (12:16 -0400)
committerColin Walters <walters@verbum.org>
Tue, 16 Mar 2010 16:21:52 +0000 (12:21 -0400)
https://bugs.freedesktop.org/show_bug.cgi?id=23957

Previously we detected glibc support at compile time and used
it unconditionally; better to try it and fall back, this way
we continue to run on older kernels when compiled for newer ones.

bus/dir-watch-inotify.c

index c98e6fc..094993b 100644 (file)
@@ -226,6 +226,11 @@ _init_inotify (BusContext *context)
     {
 #ifdef HAVE_INOTIFY_INIT1
       inotify_fd = inotify_init1 (IN_CLOEXEC);
+      /* This ensures we still run on older Linux kernels.
+       * https://bugs.freedesktop.org/show_bug.cgi?id=23957
+       */
+      if (inotify_fd < 0)
+        inotify_fd = inotify_init ();
 #else
       inotify_fd = inotify_init ();
 #endif