]> 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)
committerLuca Boccassi <luca.boccassi@gmail.com>
Mon, 4 Aug 2025 14:42:02 +0000 (15:42 +0100)
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.

(cherry picked from commit 064b9b2bb3544707171662f548677259c3d6aa7f)

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

index 7aea7d258131a64f1a9d744d42104729ebd3a559..f5a38b31d16b8bee3f09e717b3ccc920d89ab5cd 100644 (file)
@@ -4023,9 +4023,12 @@ static int event_inotify_data_process(sd_event *e, struct inotify_data *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;