depot/pkgs/applications/virtualization/qemu/fix-qemu-ga.patch
Luke Granger-Brown 57725ef3ec Squashed 'third_party/nixpkgs/' content from commit 76612b17c0ce
git-subtree-dir: third_party/nixpkgs
git-subtree-split: 76612b17c0ce71689921ca12d9ffdc9c23ce40b2
2024-11-10 23:59:47 +00:00

45 lines
1.7 KiB
Diff

diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index c2bd0b4316..47cee1c351 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -246,7 +246,7 @@ void qmp_guest_shutdown(const char *mode, Error **errp)
return;
}
- const char *argv[] = {"/sbin/shutdown",
+ const char *argv[] = {"/run/current-system/sw/bin/shutdown",
#ifdef CONFIG_SOLARIS
shutdown_flag, "-g0", "-y",
#elif defined(CONFIG_BSD)
@@ -257,6 +257,10 @@ void qmp_guest_shutdown(const char *mode, Error **errp)
"hypervisor initiated shutdown", (char *) NULL};
ga_run_command(argv, NULL, "shutdown", &local_err);
+ if (local_err) {
+ argv[0] = "/sbin/shutdown";
+ ga_run_command(argv, NULL, "shutdown", &local_err);
+ }
if (local_err) {
error_propagate(errp, local_err);
return;
@@ -270,7 +274,7 @@ void qmp_guest_set_time(bool has_time, int64_t time_ns, Error **errp)
int ret;
Error *local_err = NULL;
struct timeval tv;
- const char *argv[] = {"/sbin/hwclock", has_time ? "-w" : "-s", NULL};
+ const char *argv[] = {"/run/current-system/sw/bin/hwclock", has_time ? "-w" : "-s", NULL};
/* If user has passed a time, validate and set it. */
if (has_time) {
@@ -303,6 +307,11 @@ void qmp_guest_set_time(bool has_time, int64_t time_ns, Error **errp)
* hardware clock (RTC). */
ga_run_command(argv, NULL, "set hardware clock to system time",
&local_err);
+ if (local_err) {
+ argv[0] = "/sbin/hwclock";
+ ga_run_command(argv, NULL, "set hardware clock to system time",
+ &local_err);
+ }
if (local_err) {
error_propagate(errp, local_err);
return;