]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-event: drop inotify event from buffer when no event source is triggered
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 19 Jul 2025 17:12:00 +0000 (02:12 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 19 Jul 2025 17:14:44 +0000 (02:14 +0900)
Even when we receive an inotify event, there is no relevant event source
exists. In that case, we need to drop the event from the buffer,
otherwise we cannot escape from the loop.

Fixes #38265.

src/libsystemd/sd-event/sd-event.c

index 8ed10c9f8e5b231bac91f993517f311a0e755331..869747e929d6641ad33e66fbd034b24c31f5ded7 100644 (file)
@@ -3955,9 +3955,12 @@ static int event_inotify_data_process(sd_event *e, InotifyData *d) {
                         }
                 }
 
-                /* Something pending now? If so, let's finish, otherwise let's read more. */
+                /* Something pending now? If so, let's finish. */
                 if (d->n_pending > 0)
                         return 1;
+
+                /* otherwise, drop the event and let's read more */
+                event_inotify_data_drop(e, d, sz);
         }
 
         return 0;