]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
udev: not necessary to return 1 from on_inotify()
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 14 Apr 2022 21:08:13 +0000 (06:08 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 11 Sep 2022 16:23:08 +0000 (01:23 +0900)
src/udev/udevd.c

index c2a4a8a7bd6415fa60dfd345465c1008fbcde9c9..2574844ed763a538077c150c6b70654fc06f4262 100644 (file)
@@ -1430,17 +1430,15 @@ static int synthesize_change(sd_device *dev) {
 }
 
 static int on_inotify(sd_event_source *s, int fd, uint32_t revents, void *userdata) {
-        Manager *manager = userdata;
+        Manager *manager = ASSERT_PTR(userdata);
         union inotify_event_buffer buffer;
         ssize_t l;
         int r;
 
-        assert(manager);
-
         l = read(fd, &buffer, sizeof(buffer));
         if (l < 0) {
                 if (ERRNO_IS_TRANSIENT(errno))
-                        return 1;
+                        return 0;
 
                 return log_error_errno(errno, "Failed to read inotify fd: %m");
         }
@@ -1468,7 +1466,7 @@ static int on_inotify(sd_event_source *s, int fd, uint32_t revents, void *userda
                  * udev_event_execute_rules() -> event_execute_rules_on_remove() -> udev_watch_end(). */
         }
 
-        return 1;
+        return 0;
 }
 
 static int on_sigterm(sd_event_source *s, const struct signalfd_siginfo *si, void *userdata) {