diff options
author | Lennart Poettering <lennart@poettering.net> | 2010-10-19 21:53:19 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2010-10-19 21:53:19 +0200 |
commit | 90bb85e140a238ce76f05c473e2eb68f147671f3 (patch) | |
tree | 9d6b28bf28a4ba26acee450fd63485e29101808e /src/fsck.c | |
parent | 3e33a44a01078ea0699dca160b93f0399fbc994b (diff) |
fsck: atomically replace base.target by rescue.target/reboot.target when fsck fails
Diffstat (limited to 'src/fsck.c')
-rw-r--r-- | src/fsck.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/fsck.c b/src/fsck.c index 702f22c95d..b0c3620c8c 100644 --- a/src/fsck.c +++ b/src/fsck.c @@ -38,7 +38,7 @@ static bool arg_force = false; static void start_target(const char *target, bool isolate) { DBusMessage *m = NULL, *reply = NULL; DBusError error; - const char *mode; + const char *mode, *base_target = "base.target"; DBusConnection *bus = NULL; assert(target); @@ -57,12 +57,15 @@ static void start_target(const char *target, bool isolate) { log_debug("Running request %s/start/%s", target, mode); - if (!(m = dbus_message_new_method_call("org.freedesktop.systemd1", "/org/freedesktop/systemd1", "org.freedesktop.systemd1.Manager", "StartUnit"))) { + if (!(m = dbus_message_new_method_call("org.freedesktop.systemd1", "/org/freedesktop/systemd1", "org.freedesktop.systemd1.Manager", "StartUnitReplace"))) { log_error("Could not allocate message."); goto finish; } + /* Start these units only if we can replace base.target with it */ + if (!dbus_message_append_args(m, + DBUS_TYPE_STRING, &base_target, DBUS_TYPE_STRING, &target, DBUS_TYPE_STRING, &mode, DBUS_TYPE_INVALID)) { @@ -196,11 +199,7 @@ int main(int argc, char *argv[]) { } if (status.si_status & ~1) { - - if (access("/dev/.systemd/late-fsck", F_OK) >= 0) { - log_error("fsck failed with error code %i.", status.si_status); - goto finish; - } + log_error("fsck failed with error code %i.", status.si_status); if (status.si_status & 2) /* System should be rebooted. */ |