]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
bus: Correct check for inotify_init() failure
authorSimon McVittie <smcv@collabora.com>
Fri, 10 Dec 2021 13:08:38 +0000 (13:08 +0000)
committerSimon McVittie <smcv@collabora.com>
Fri, 10 Dec 2021 13:18:39 +0000 (13:18 +0000)
fd 0 is a valid fd - although if we get stdin as our inotify fd, something
is weird somewhere. For the dbus-daemon, in practice this should never
happen, because we use _dbus_ensure_standard_fds() to make sure stdin
is already open. For unit tests, it could in theory be the case that
stdin is closed.

Signed-off-by: Simon McVittie <smcv@collabora.com>
bus/dir-watch-inotify.c

index 940f09a08e01cae832df883501e4178b9957ea51..6cc02968f123faab6b826c9bcb55f0252d08ee7c 100644 (file)
@@ -234,7 +234,7 @@ _init_inotify (BusContext *context)
 #else
       inotify_fd = inotify_init ();
 #endif
-      if (inotify_fd <= 0)
+      if (inotify_fd < 0)
         {
           _dbus_warn ("Cannot initialize inotify");
           goto out;