ryantimwilson / rpms / systemd

Forked from rpms/systemd a month ago
Clone
b677e7
From bf370d05bbc8c4d91c8c2b455116e59a24e48911 Mon Sep 17 00:00:00 2001
b677e7
From: Yu Watanabe <watanabe.yu+github@gmail.com>
b677e7
Date: Tue, 15 Jun 2021 02:03:02 +0900
b677e7
Subject: [PATCH] sd-event: make event_source_time_prioq_reshuffle() accept all
b677e7
 event source type
b677e7
b677e7
But it does nothing for an event source which is neither a timer nor
b677e7
ratelimited.
b677e7
b677e7
(cherry picked from commit 5c08c7ab23dbf02aaf4e4bbae8e08a195da230a4)
b677e7
b677e7
Related: #1968528
b677e7
---
b677e7
 src/libsystemd/sd-event/sd-event.c | 9 +++++----
b677e7
 1 file changed, 5 insertions(+), 4 deletions(-)
b677e7
b677e7
diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
b677e7
index f675c09d84..ae46392901 100644
b677e7
--- a/src/libsystemd/sd-event/sd-event.c
b677e7
+++ b/src/libsystemd/sd-event/sd-event.c
b677e7
@@ -954,14 +954,15 @@ static void event_source_time_prioq_reshuffle(sd_event_source *s) {
b677e7
         assert(s);
b677e7
 
b677e7
         /* Called whenever the event source's timer ordering properties changed, i.e. time, accuracy,
b677e7
-         * pending, enable state. Makes sure the two prioq's are ordered properly again. */
b677e7
+         * pending, enable state, and ratelimiting state. Makes sure the two prioq's are ordered
b677e7
+         * properly again. */
b677e7
 
b677e7
         if (s->ratelimited)
b677e7
                 d = &s->event->monotonic;
b677e7
-        else {
b677e7
-                assert(EVENT_SOURCE_IS_TIME(s->type));
b677e7
+        else if (EVENT_SOURCE_IS_TIME(s->type))
b677e7
                 assert_se(d = event_get_clock_data(s->event, s->type));
b677e7
-        }
b677e7
+        else
b677e7
+                return; /* no-op for an event source which is neither a timer nor ratelimited. */
b677e7
 
b677e7
         prioq_reshuffle(d->earliest, s, &s->earliest_index);
b677e7
         prioq_reshuffle(d->latest, s, &s->latest_index);