1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-08 11:27:32 +03:00

Merge pull request #1394 from steelman/fsck-force-reboot

fsck: start reboot.target irreversibly
This commit is contained in:
Lennart Poettering 2015-09-30 15:39:29 +02:00
commit 6b68a4442e

View File

@ -60,7 +60,7 @@ static bool arg_force = false;
static bool arg_show_progress = false; static bool arg_show_progress = false;
static const char *arg_repair = "-a"; static const char *arg_repair = "-a";
static void start_target(const char *target) { static void start_target(const char *target, const char *mode) {
_cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL; _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
_cleanup_bus_flush_close_unref_ sd_bus *bus = NULL; _cleanup_bus_flush_close_unref_ sd_bus *bus = NULL;
int r; int r;
@ -83,7 +83,7 @@ static void start_target(const char *target) {
"StartUnitReplace", "StartUnitReplace",
&error, &error,
NULL, NULL,
"sss", "basic.target", target, "replace"); "sss", "basic.target", target, mode);
/* Don't print a warning if we aren't called during startup */ /* Don't print a warning if we aren't called during startup */
if (r < 0 && !sd_bus_error_has_name(&error, BUS_ERROR_NO_SUCH_JOB)) if (r < 0 && !sd_bus_error_has_name(&error, BUS_ERROR_NO_SUCH_JOB))
@ -463,10 +463,10 @@ int main(int argc, char *argv[]) {
if (status.si_code == CLD_EXITED && (status.si_status & FSCK_SYSTEM_SHOULD_REBOOT) && root_directory) if (status.si_code == CLD_EXITED && (status.si_status & FSCK_SYSTEM_SHOULD_REBOOT) && root_directory)
/* System should be rebooted. */ /* System should be rebooted. */
start_target(SPECIAL_REBOOT_TARGET); start_target(SPECIAL_REBOOT_TARGET, "replace-irreversibly");
else if (status.si_code == CLD_EXITED && (status.si_status & (FSCK_SYSTEM_SHOULD_REBOOT | FSCK_ERRORS_LEFT_UNCORRECTED))) else if (status.si_code == CLD_EXITED && (status.si_status & (FSCK_SYSTEM_SHOULD_REBOOT | FSCK_ERRORS_LEFT_UNCORRECTED)))
/* Some other problem */ /* Some other problem */
start_target(SPECIAL_EMERGENCY_TARGET); start_target(SPECIAL_EMERGENCY_TARGET, "replace");
else { else {
log_warning("Ignoring error."); log_warning("Ignoring error.");
r = 0; r = 0;