From 1b6df97690b432d270ff3c0aae16b4cd52f18794 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Thu, 15 Mar 2012 01:01:19 +0100 Subject: [PATCH] linux: try inotify_init if inotify_init1 returns ENOSYS The kernel may be older than the kernel headers that libuv is compiled against. --- src/unix/linux/inotify.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/unix/linux/inotify.c b/src/unix/linux/inotify.c index 609be9735..2e905685c 100644 --- a/src/unix/linux/inotify.c +++ b/src/unix/linux/inotify.c @@ -156,11 +156,16 @@ static void uv__inotify_read(EV_P_ ev_io* w, int revents); static int new_inotify_fd(void) { -#if HAVE_INOTIFY_INIT1 - return inotify_init1(IN_NONBLOCK | IN_CLOEXEC); -#else int fd; +#if HAVE_INOTIFY_INIT1 + fd = inotify_init1(IN_NONBLOCK | IN_CLOEXEC); + if (fd != -1) + return fd; + if (errno != ENOSYS) + return -1; +#endif + if ((fd = inotify_init()) == -1) return -1; @@ -170,7 +175,6 @@ static int new_inotify_fd(void) { } return fd; -#endif }