From d90e1a301d61c3808ac5c0aa3093b2ec913e406b Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sat, 14 Aug 2010 19:14:52 +0200 Subject: [PATCH] systemctl: skip writing of utmp if we booted using systemd, under the assumption that systemd-update-utmp is used --- fixme | 2 +- src/fdset.c | 1 - src/systemctl.c | 7 +++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/fixme b/fixme index 26a9787f..e9acede7 100644 --- a/fixme +++ b/fixme @@ -1,7 +1,7 @@ * dot output for --test showing the 'initial transaction' * check 'disable' - "Warning: Unit file changed in disk, 'systemctl --system daemon-reload' recomended + "Warning: Unit file changed in disk, 'systemctl --system daemon-reload' recommended when does it do that? if you disable the service diff --git a/src/fdset.c b/src/fdset.c index b6d5286f..ad7cd294 100644 --- a/src/fdset.c +++ b/src/fdset.c @@ -144,7 +144,6 @@ finish: set_free(MAKE_SET(s)); return r; - } int fdset_cloexec(FDSet *fds, bool b) { diff --git a/src/systemctl.c b/src/systemctl.c index 9a85383d..167c6a5b 100644 --- a/src/systemctl.c +++ b/src/systemctl.c @@ -4680,9 +4680,12 @@ static int halt_main(DBusConnection *bus) { if (!arg_dry && !arg_immediate) return start_with_fallback(bus); - if (!arg_no_wtmp) - if ((r = utmp_put_shutdown(0)) < 0) + if (!arg_no_wtmp) { + if (sd_booted() > 0) + log_debug("Not writing utmp record, assuming that systemd-update-utmp is used."); + else if ((r = utmp_put_shutdown(0)) < 0) log_warning("Failed to write utmp record: %s", strerror(-r)); + } if (!arg_no_sync) sync(); -- 2.39.5