2020-04-27 20:48:18 +01:00
|
|
|
diff -Naur a/qga/commands-posix.c b/qga/commands-posix.c
|
2018-08-10 19:59:53 +01:00
|
|
|
--- a/qga/commands-posix.c
|
|
|
|
+++ b/qga/commands-posix.c
|
2020-04-27 20:48:18 +01:00
|
|
|
@@ -109,6 +109,8 @@
|
2018-08-10 19:59:53 +01:00
|
|
|
reopen_fd_to_null(1);
|
|
|
|
reopen_fd_to_null(2);
|
2020-04-27 20:48:18 +01:00
|
|
|
|
2018-08-10 19:59:53 +01:00
|
|
|
+ execle("/run/current-system/sw/bin/shutdown", "shutdown", "-h", shutdown_flag, "+0",
|
|
|
|
+ "hypervisor initiated shutdown", (char*)NULL, environ);
|
|
|
|
execle("/sbin/shutdown", "shutdown", "-h", shutdown_flag, "+0",
|
|
|
|
"hypervisor initiated shutdown", (char*)NULL, environ);
|
|
|
|
_exit(EXIT_FAILURE);
|
2020-04-27 20:48:18 +01:00
|
|
|
@@ -157,11 +159,13 @@
|
|
|
|
pid_t pid;
|
|
|
|
Error *local_err = NULL;
|
|
|
|
struct timeval tv;
|
|
|
|
+ static const char hwclock_path_nix[] = "/run/current-system/sw/bin/hwclock";
|
|
|
|
static const char hwclock_path[] = "/sbin/hwclock";
|
|
|
|
static int hwclock_available = -1;
|
|
|
|
|
|
|
|
if (hwclock_available < 0) {
|
|
|
|
- hwclock_available = (access(hwclock_path, X_OK) == 0);
|
|
|
|
+ hwclock_available = (access(hwclock_path_nix, X_OK) == 0) ||
|
|
|
|
+ (access(hwclock_path, X_OK) == 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!hwclock_available) {
|
|
|
|
@@ -207,6 +211,8 @@
|
|
|
|
|
2018-08-10 19:59:53 +01:00
|
|
|
/* Use '/sbin/hwclock -w' to set RTC from the system time,
|
|
|
|
* or '/sbin/hwclock -s' to set the system time from RTC. */
|
2020-04-27 20:48:18 +01:00
|
|
|
+ execle(hwclock_path_nix, "hwclock", has_time ? "-w" : "-s",
|
2018-08-10 19:59:53 +01:00
|
|
|
+ NULL, environ);
|
2020-04-27 20:48:18 +01:00
|
|
|
execle(hwclock_path, "hwclock", has_time ? "-w" : "-s",
|
2018-08-10 19:59:53 +01:00
|
|
|
NULL, environ);
|
|
|
|
_exit(EXIT_FAILURE);
|