aboutsummaryrefslogtreecommitdiff
path: root/nixpkgs/pkgs/applications/virtualization/qemu/fix-qemu-ga.patch
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/applications/virtualization/qemu/fix-qemu-ga.patch')
-rw-r--r--nixpkgs/pkgs/applications/virtualization/qemu/fix-qemu-ga.patch30
1 files changed, 22 insertions, 8 deletions
diff --git a/nixpkgs/pkgs/applications/virtualization/qemu/fix-qemu-ga.patch b/nixpkgs/pkgs/applications/virtualization/qemu/fix-qemu-ga.patch
index c2f051e2b94..0b2dd0ee5ec 100644
--- a/nixpkgs/pkgs/applications/virtualization/qemu/fix-qemu-ga.patch
+++ b/nixpkgs/pkgs/applications/virtualization/qemu/fix-qemu-ga.patch
@@ -1,22 +1,36 @@
-diff --git a/qga/commands-posix.c b/qga/commands-posix.c
-index 0dc219d..9d020d3 100644
+diff -Naur a/qga/commands-posix.c b/qga/commands-posix.c
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
-@@ -102,6 +102,8 @@ void qmp_guest_shutdown(bool has_mode, const char *mode, Error **errp)
+@@ -109,6 +109,8 @@
reopen_fd_to_null(1);
reopen_fd_to_null(2);
-
+
+ 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);
-@@ -189,6 +191,8 @@ void qmp_guest_set_time(bool has_time, int64_t time_ns, Error **errp)
-
+@@ -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 @@
+
/* Use '/sbin/hwclock -w' to set RTC from the system time,
* or '/sbin/hwclock -s' to set the system time from RTC. */
-+ execle("/run/current-system/sw/bin/hwclock", "hwclock", has_time ? "-w" : "-s",
++ execle(hwclock_path_nix, "hwclock", has_time ? "-w" : "-s",
+ NULL, environ);
- execle("/sbin/hwclock", "hwclock", has_time ? "-w" : "-s",
+ execle(hwclock_path, "hwclock", has_time ? "-w" : "-s",
NULL, environ);
_exit(EXIT_FAILURE);