qemu: update to 9.0.0
[feed/packages.git] / utils / qemu / patches / 0007-qga-invoke-separate-applets-for-guest-shutdown-modes.patch
index d51abc2d5b256df2c5918b486ef2f3a16c871e0f..94061b8bf281d28f34df693f99e23fe03a84b764 100644 (file)
@@ -13,33 +13,33 @@ https://gitlab.alpinelinux.org/alpine/aports/commit/76b81b486480fd9c3294cd420bcf
 
 --- a/qga/commands-posix.c
 +++ b/qga/commands-posix.c
-@@ -84,6 +84,7 @@ static void ga_wait_child(pid_t pid, int
- void qmp_guest_shutdown(bool has_mode, const char *mode, Error **errp)
+@@ -79,6 +79,7 @@ static void ga_wait_child(pid_t pid, int
+ void qmp_guest_shutdown(const char *mode, Error **errp)
  {
      const char *shutdown_flag;
 +    const char *fallback_cmd = NULL;
      Error *local_err = NULL;
      pid_t pid;
      int status;
-@@ -91,10 +92,13 @@ void qmp_guest_shutdown(bool has_mode, c
+@@ -100,10 +101,13 @@ void qmp_guest_shutdown(const char *mode
      slog("guest-shutdown called, mode: %s", mode);
-     if (!has_mode || strcmp(mode, "powerdown") == 0) {
-         shutdown_flag = "-P";
+     if (!mode || strcmp(mode, "powerdown") == 0) {
+         shutdown_flag = powerdown_flag;
 +        fallback_cmd = "/sbin/poweroff";
      } else if (strcmp(mode, "halt") == 0) {
-         shutdown_flag = "-H";
+         shutdown_flag = halt_flag;
 +        fallback_cmd = "/sbin/halt";
      } else if (strcmp(mode, "reboot") == 0) {
-         shutdown_flag = "-r";
+         shutdown_flag = reboot_flag;
 +        fallback_cmd = "/sbin/reboot";
      } else {
          error_setg(errp,
                     "mode is invalid (valid values are: halt|powerdown|reboot");
-@@ -111,6 +115,7 @@ void qmp_guest_shutdown(bool has_mode, c
-         execle("/sbin/shutdown", "shutdown", "-h", shutdown_flag, "+0",
-                "hypervisor initiated shutdown", (char *)NULL, environ);
-+        execle(fallback_cmd, fallback_cmd, (char*)NULL, environ);
+@@ -128,6 +132,7 @@ void qmp_guest_shutdown(const char *mode
+         execl("/sbin/shutdown", "shutdown", "-h", shutdown_flag, "+0",
+                "hypervisor initiated shutdown", (char *)NULL);
+ #endif
++        execl(fallback_cmd, fallback_cmd, (char*)NULL);
          _exit(EXIT_FAILURE);
      } else if (pid < 0) {
          error_setg_errno(errp, errno, "failed to create child process");