From: Yu Watanabe Date: Sat, 19 Jul 2025 17:12:00 +0000 (+0900) Subject: sd-event: drop inotify event from buffer when no event source is triggered X-Git-Tag: v258-rc1~26^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=064b9b2bb3544707171662f548677259c3d6aa7f;p=thirdparty%2Fsystemd.git sd-event: drop inotify event from buffer when no event source is triggered 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. --- diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c index 8ed10c9f8e5..869747e929d 100644 --- a/src/libsystemd/sd-event/sd-event.c +++ b/src/libsystemd/sd-event/sd-event.c @@ -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;