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

systemctl: minor modernizations

This commit is contained in:
Lennart Poettering 2015-09-29 15:08:33 +02:00
parent e449de8777
commit 19578bb26b

View File

@ -7425,22 +7425,22 @@ static int halt_now(enum action a) {
/* The kernel will automaticall flush ATA disks and suchlike /* The kernel will automaticall flush ATA disks and suchlike
* on reboot(), but the file systems need to be synce'd * on reboot(), but the file systems need to be synce'd
* explicitly in advance. */ * explicitly in advance. */
sync(); (void) sync();
/* Make sure C-A-D is handled by the kernel from this point /* Make sure C-A-D is handled by the kernel from this point
* on... */ * on... */
reboot(RB_ENABLE_CAD); (void) reboot(RB_ENABLE_CAD);
switch (a) { switch (a) {
case ACTION_HALT: case ACTION_HALT:
log_info("Halting."); log_info("Halting.");
reboot(RB_HALT_SYSTEM); (void) reboot(RB_HALT_SYSTEM);
return -errno; return -errno;
case ACTION_POWEROFF: case ACTION_POWEROFF:
log_info("Powering off."); log_info("Powering off.");
reboot(RB_POWER_OFF); (void) reboot(RB_POWER_OFF);
return -errno; return -errno;
case ACTION_KEXEC: case ACTION_KEXEC:
@ -7449,11 +7449,11 @@ static int halt_now(enum action a) {
if (read_one_line_file(REBOOT_PARAM_FILE, &param) >= 0) { if (read_one_line_file(REBOOT_PARAM_FILE, &param) >= 0) {
log_info("Rebooting with argument '%s'.", param); log_info("Rebooting with argument '%s'.", param);
syscall(SYS_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_RESTART2, param); (void) syscall(SYS_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_RESTART2, param);
} }
log_info("Rebooting."); log_info("Rebooting.");
reboot(RB_AUTOBOOT); (void) reboot(RB_AUTOBOOT);
return -errno; return -errno;
} }