]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-event: do not ignore result of callbacks
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 15 Nov 2025 20:43:59 +0000 (05:43 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 15 Nov 2025 20:44:35 +0000 (05:44 +0900)
Follow-up for 4c8b6d636c92e84f4b40db5656db58f71f397a1d and
6aff6d3ffc8a481bb663ac4dd0cf479845a6e24f.
Fixes CID#1643218 and friends.

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

index a211d62f007637aaaf8a140c20c3fb94bcade5a8..044cdf246d180e8e6784dbb763c62e4ea90e36bc 100644 (file)
@@ -4249,12 +4249,6 @@ static int source_dispatch(sd_event_source *s) {
 
         s->dispatching = false;
 
-        /* More post sources might have been added while executing the callback, let's make sure
-         * those are marked pending as well. */
-        r = maybe_mark_post_sources_pending(saved_type, saved_event);
-        if (r < 0)
-                return r;
-
 finish:
         if (r < 0) {
                 log_debug_errno(r, "Event source %s (type %s) returned error, %s: %m",
@@ -4271,6 +4265,12 @@ finish:
         else if (r < 0)
                 assert_se(sd_event_source_set_enabled(s, SD_EVENT_OFF) >= 0);
 
+        /* More post sources might have been added while executing the callback, let's make sure
+         * those are marked pending as well. */
+        r = maybe_mark_post_sources_pending(saved_type, saved_event);
+        if (r < 0)
+                return r;
+
         return 1;
 }