diff options
Diffstat (limited to 'gnu/packages/patches/qemu-fix-agent-paths.patch')
-rw-r--r-- | gnu/packages/patches/qemu-fix-agent-paths.patch | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/gnu/packages/patches/qemu-fix-agent-paths.patch b/gnu/packages/patches/qemu-fix-agent-paths.patch index bae62fadbf..0c29890206 100644 --- a/gnu/packages/patches/qemu-fix-agent-paths.patch +++ b/gnu/packages/patches/qemu-fix-agent-paths.patch @@ -4,7 +4,6 @@ after the patch from the Nix package: https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/virtualization/qemu/fix-qemu-ga.patch diff --git a/qga/commands-posix.c b/qga/commands-posix.c -index 75dbaab..b416b03 100644 --- a/qga/commands-posix.c +++ b/qga/commands-posix.c @@ -84,6 +84,7 @@ static void ga_wait_child(pid_t pid, int *status, Error **errp) @@ -15,33 +14,33 @@ index 75dbaab..b416b03 100644 Error *local_err = NULL; pid_t pid; int status; -@@ -91,10 +92,13 @@ void qmp_guest_shutdown(bool has_mode, const char *mode, Error **errp) +@@ -101,10 +102,13 @@ void qmp_guest_shutdown(bool has_mode, const char *mode, Error **errp) slog("guest-shutdown called, mode: %s", mode); if (!has_mode || strcmp(mode, "powerdown") == 0) { - shutdown_flag = "-P"; + shutdown_flag = powerdown_flag; + command = "shutdown"; } else if (strcmp(mode, "halt") == 0) { - shutdown_flag = "-H"; + shutdown_flag = halt_flag; + command = "halt"; } else if (strcmp(mode, "reboot") == 0) { - shutdown_flag = "-r"; + shutdown_flag = reboot_flag; + command = "reboot"; } else { error_setg(errp, "mode is invalid (valid values are: halt|powerdown|reboot"); -@@ -109,6 +113,11 @@ void qmp_guest_shutdown(bool has_mode, const char *mode, Error **errp) - reopen_fd_to_null(1); - reopen_fd_to_null(2); - +@@ -123,6 +127,11 @@ void qmp_guest_shutdown(bool has_mode, const char *mode, Error **errp) + execl("/sbin/shutdown", "shutdown", shutdown_flag, "-g0", "-y", + "hypervisor initiated shutdown", (char *)NULL); + #else + /* try Guix’s shutdown/halt/reboot first */ + char *path = g_strdup_printf("/run/current-system/profile/sbin/%s", command); -+ execle(path, command, (char *)NULL, environ); ++ execl(path, command, (char *)NULL); + g_free(path); + - execle("/sbin/shutdown", "shutdown", "-h", shutdown_flag, "+0", - "hypervisor initiated shutdown", (char *)NULL, environ); - _exit(EXIT_FAILURE); -@@ -158,10 +167,12 @@ void qmp_guest_set_time(bool has_time, int64_t time_ns, Error **errp) + execl("/sbin/shutdown", "shutdown", "-h", shutdown_flag, "+0", + "hypervisor initiated shutdown", (char *)NULL); + #endif +@@ -159,10 +168,12 @@ void qmp_guest_set_time(bool has_time, int64_t time_ns, Error **errp) Error *local_err = NULL; struct timeval tv; static const char hwclock_path[] = "/sbin/hwclock"; @@ -55,12 +54,12 @@ index 75dbaab..b416b03 100644 } if (!hwclock_available) { -@@ -207,6 +218,8 @@ void qmp_guest_set_time(bool has_time, int64_t time_ns, Error **errp) +@@ -208,6 +219,8 @@ void qmp_guest_set_time(bool has_time, int64_t time_ns, Error **errp) /* Use '/sbin/hwclock -w' to set RTC from the system time, * or '/sbin/hwclock -s' to set the system time from RTC. */ -+ execle(hwclock_path_guix, "hwclock", has_time ? "-w" : "-s", -+ NULL, environ); - execle(hwclock_path, "hwclock", has_time ? "-w" : "-s", - NULL, environ); ++ execl(hwclock_path_guix, "hwclock", has_time ? "-w" : "-s", ++ NULL); + execl(hwclock_path, "hwclock", has_time ? "-w" : "-s", NULL); _exit(EXIT_FAILURE); + } else if (pid < 0) { |