mirror of
https://github.com/systemd/systemd.git
synced 2025-02-09 13:57:42 +03:00
Merge pull request #1366 from pocek/sd-event-fixes
sd-event: fix prepare priority queue comparison function
This commit is contained in:
commit
2e396de8b2
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user