sd-event: update state at the end in event_source_enable
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 10 Nov 2020 09:38:37 +0000 (10:38 +0100)
committerThe Plumber <50238977+systemd-rhel-bot@users.noreply.github.com>
Wed, 10 Mar 2021 11:41:30 +0000 (12:41 +0100)
commitdeb9e6ad3a1d7cfbc3b53d1e74cda6ae398a90fd
treeb37619dd5bef31929ae438f5a53ed254f9fd9112
parent97f599bf57fdaee688ae5750e9b2b2587e2b597a
sd-event: update state at the end in event_source_enable

Coverity in CID#1435966 was complaining that s->enabled is not "restored" in
all cases. But the code was actually correct, since it should only be
"restored" in the error paths. But let's still make this prettier by not setting
the state before all operations that may fail are done.

We need to set .enabled for the prioq reshuffling operations, so move those down.

No functional change intended.

(cherry picked from commit d2eafe61ca07f8300dc741a0491a914213fa2b6b)

Related: #1819868
src/libsystemd/sd-event/sd-event.c