summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-event/sd-event.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-09-24 11:27:08 +0200
committerLennart Poettering <lennart@poettering.net>2015-09-24 11:27:08 +0200
commit2e396de8b2317fdd1cb2f5eb1df8dffd13bf1e80 (patch)
treebbb29e691391ff93df443ac6b5f915a99258ad1a /src/libsystemd/sd-event/sd-event.c
parent56c581598389739ba2a97baf896ea9277c278a1d (diff)
parent8046c4576a68977a1089d2585866bfab8152661b (diff)
Merge pull request #1366 from pocek/sd-event-fixes
sd-event: fix prepare priority queue comparison function
Diffstat (limited to 'src/libsystemd/sd-event/sd-event.c')
-rw-r--r--src/libsystemd/sd-event/sd-event.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c
index fd39a56225..48a5219275 100644
--- a/src/libsystemd/sd-event/sd-event.c
+++ b/src/libsystemd/sd-event/sd-event.c
@@ -257,6 +257,12 @@ static int prepare_prioq_compare(const void *a, const void *b) {
assert(x->prepare);
assert(y->prepare);
+ /* Enabled ones first */
+ if (x->enabled != SD_EVENT_OFF && y->enabled == SD_EVENT_OFF)
+ return -1;
+ if (x->enabled == SD_EVENT_OFF && y->enabled != SD_EVENT_OFF)
+ return 1;
+
/* Move most recently prepared ones last, so that we can stop
* preparing as soon as we hit one that has already been
* prepared in the current iteration */
@@ -265,12 +271,6 @@ static int prepare_prioq_compare(const void *a, const void *b) {
if (x->prepare_iteration > y->prepare_iteration)
return 1;
- /* Enabled ones first */
- if (x->enabled != SD_EVENT_OFF && y->enabled == SD_EVENT_OFF)
- return -1;
- if (x->enabled == SD_EVENT_OFF && y->enabled != SD_EVENT_OFF)
- return 1;
-
/* Lower priority values first */
if (x->priority < y->priority)
return -1;