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