summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2021-06-15 02:03:02 +0900
committerThe Plumber <50238977+systemd-rhel-bot@users.noreply.github.com>2021-07-21 14:15:58 +0200
commitbf370d05bbc8c4d91c8c2b455116e59a24e48911 (patch)
treeadb27e91ff9e40b8f3ec7e81b3d460b5d9f74c67
parentb79e00d8f97b8c959c5b17f0547c680f86dd9132 (diff)
downloadsystemd-bf370d05bbc8c4d91c8c2b455116e59a24e48911.tar.gz
sd-event: make event_source_time_prioq_reshuffle() accept all event source type
But it does nothing for an event source which is neither a timer nor ratelimited. (cherry picked from commit 5c08c7ab23dbf02aaf4e4bbae8e08a195da230a4) Related: #1968528
-rw-r--r--src/libsystemd/sd-event/sd-event.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
index f675c09d84..ae46392901 100644
--- a/src/libsystemd/sd-event/sd-event.c
+++ b/src/libsystemd/sd-event/sd-event.c
@@ -954,14 +954,15 @@ static void event_source_time_prioq_reshuffle(sd_event_source *s) {
assert(s);
/* Called whenever the event source's timer ordering properties changed, i.e. time, accuracy,
- * pending, enable state. Makes sure the two prioq's are ordered properly again. */
+ * pending, enable state, and ratelimiting state. Makes sure the two prioq's are ordered
+ * properly again. */
if (s->ratelimited)
d = &s->event->monotonic;
- else {
- assert(EVENT_SOURCE_IS_TIME(s->type));
+ else if (EVENT_SOURCE_IS_TIME(s->type))
assert_se(d = event_get_clock_data(s->event, s->type));
- }
+ else
+ return; /* no-op for an event source which is neither a timer nor ratelimited. */
prioq_reshuffle(d->earliest, s, &s->earliest_index);
prioq_reshuffle(d->latest, s, &s->latest_index);