mirror of
https://github.com/akuker/RASCSI.git
synced 2024-12-21 23:29:39 +00:00
Feature shutdown improvement (#556)
* Use init instead of reboot for shutdown and restart * Include file update
This commit is contained in:
parent
94786aec54
commit
e2580d77cf
@ -28,8 +28,6 @@
|
||||
#include "rascsi_interface.pb.h"
|
||||
#include "spdlog/spdlog.h"
|
||||
#include "spdlog/sinks/stdout_color_sinks.h"
|
||||
#include <sys/reboot.h>
|
||||
#include <linux/reboot.h>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
@ -1162,9 +1160,8 @@ void ShutDown(int fd, const string& mode) {
|
||||
SerializeMessage(fd, result);
|
||||
|
||||
DetachAll();
|
||||
sync();
|
||||
|
||||
if (reboot(LINUX_REBOOT_CMD_HALT) == -1) {
|
||||
if (system("init 0") == -1) {
|
||||
LOGERROR("System shutdown failed: %s", strerror(errno));
|
||||
}
|
||||
}
|
||||
@ -1174,9 +1171,8 @@ void ShutDown(int fd, const string& mode) {
|
||||
SerializeMessage(fd, result);
|
||||
|
||||
DetachAll();
|
||||
sync();
|
||||
|
||||
if (reboot(LINUX_REBOOT_CMD_RESTART) == -1) {
|
||||
if (system("init 6") == -1) {
|
||||
LOGERROR("System reboot failed: %s", strerror(errno));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user