From: Simon McVittie Date: Fri, 10 Dec 2021 13:08:38 +0000 (+0000) Subject: bus: Correct check for inotify_init() failure X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5eb3615ca393c0de144aba0193e62330e89942a2;p=thirdparty%2Fdbus.git bus: Correct check for inotify_init() failure 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 --- diff --git a/bus/dir-watch-inotify.c b/bus/dir-watch-inotify.c index 940f09a08..6cc02968f 100644 --- a/bus/dir-watch-inotify.c +++ b/bus/dir-watch-inotify.c @@ -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;