]> git.ipfire.org Git - thirdparty/systemd.git/commit
bus-unit-util: rework UnitFreezer, explicitly thaw unit
authorMike Yuan <me@yhndnzj.com>
Thu, 30 May 2024 06:43:41 +0000 (14:43 +0800)
committerMike Yuan <me@yhndnzj.com>
Thu, 30 May 2024 13:51:48 +0000 (21:51 +0800)
commit12904d5387059dec6e148fc7f33fc0e3087009d4
treee4ca298bf373d0a72523c6d798eaf93cac5fb5f3
parent759ac0dec33bbd9d307f19e4565d4548215fe5b4
bus-unit-util: rework UnitFreezer, explicitly thaw unit

Currently, we don't explicitly call unit_freezer_thaw(),
but rely on the destructor to thaw the frozen unit on
return. This has several problems though, one of them
being that we ignore the return value of ThawUnit(),
which is something we really shouldn't do here,
since such failure can easily leave the whole system
in unusable state. Moreover, the logging is kinda messy,
e.g. homed might log "Everything completed" yet immediately
followed by "Failed to thaw unit". Instead, we should log
consistently and at higher level, to make things more
debuggable.

Therefore, let's step away from the practice. Plus,
make UnitFreezer object heap-allocated, to match
with existing unit_freezer_new() and allow us to
use NULL to denote that the freezer is disabled.
src/home/homework.c
src/shared/bus-unit-util.c
src/shared/bus-unit-util.h
src/sleep/sleep.c