[PATCH] Fix for https://gitlab.com/qemu-project/qemu/-/work_items/4141:
Thomas Dreibholz <[email protected]>
| Newsgroups | org.nongnu.qemu-devel |
|---|---|
| Message-ID | <[email protected]> |
Using the correct paths for "shutdown", "reboot", etc. under Solaris. Signed-off-by: Thomas Dreibholz <[email protected]> --- This patch fixes the issue of the not-working shutdown command in the QEMU Guest Agent under Solaris (https://gitlab.com/qemu-project/qemu/-/work_items/4141) by fixing the command paths from /sbin/ to /usr/sbin/ in the Solaris build. --- qga/commands-posix.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/qga/commands-posix.c b/qga/commands-posix.c index 837be51c40..e24248a0f3 100644 --- a/qga/commands-posix.c +++ b/qga/commands-posix.c @@ -216,9 +216,17 @@ out: return retcode; } +#ifdef CONFIG_SOLARIS +#define POWEROFF_CMD_PATH "/usr/sbin/poweroff" +#define SHUTDOWN_CMD_PATH "/usr/sbin/shutdown" +#define HALT_CMD_PATH "/usr/sbin/halt" +#define REBOOT_CMD_PATH "/usr/sbin/reboot" +#else #define POWEROFF_CMD_PATH "/sbin/poweroff" -#define HALT_CMD_PATH "/sbin/halt" -#define REBOOT_CMD_PATH "/sbin/reboot" +#define SHUTDOWN_CMD_PATH "/sbin/shutdown" +#define HALT_CMD_PATH "/sbin/halt" +#define REBOOT_CMD_PATH "/sbin/reboot" +#endif void qmp_guest_shutdown(const char *mode, Error **errp) { @@ -262,7 +270,7 @@ void qmp_guest_shutdown(const char *mode, Error **errp) return; } - const char *argv[] = {"/sbin/shutdown", + const char *argv[] = {SHUTDOWN_CMD_PATH, #ifdef CONFIG_SOLARIS shutdown_flag, "-g0", "-y", #elif defined(CONFIG_BSD) @@ -274,7 +282,7 @@ void qmp_guest_shutdown(const char *mode, Error **errp) /* * If the specific command exists (poweroff, halt or reboot), use it instead - * of /sbin/shutdown. + * of SHUTDOWN_CMD_PATH. */ if (shutdown_cmd != NULL) { argv[0] = shutdown_cmd; --- base-commit: 3e3ccab106f879b1512f8e0d51a827dd4de30e22 change-id: 20260808-solaris-qga-fix-b4-d25104a17fb7 Best regards, -- Thomas Dreibholz <[email protected]>