assert(argc >= 0);
assert(argv);
+ /* called in sysvinit system as last command in shutdown/reboot so this is always forceful */
if (utmp_get_runlevel(&runlevel, NULL) >= 0)
if (IN_SET(runlevel, '0', '6'))
arg_force = 2;
return 0;
r = halt_now(arg_action);
- return log_error_errno(r, "Failed to reboot: %m");
+ return log_error_errno(r, "Failed to %s: %m", action_table[arg_action].verb);
}
}
int start_with_fallback(void) {
+ int r;
+
/* First, try systemd via D-Bus. */
- if (start_unit(0, NULL, NULL) == 0)
+ r = start_unit(0, NULL, NULL);
+ if (r == 0)
return 0;
#if HAVE_SYSV_COMPAT
return 0;
#endif
- return log_error_errno(SYNTHETIC_ERRNO(EIO),
- "Failed to talk to init daemon.");
+ return log_error_errno(r, "Failed to talk to init daemon: %m");
}
int reload_with_fallback(void) {