aboutsummaryrefslogtreecommitdiff
path: root/qga/commands-win32.c
diff options
context:
space:
mode:
Diffstat (limited to 'qga/commands-win32.c')
-rw-r--r--qga/commands-win32.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/qga/commands-win32.c b/qga/commands-win32.c
index 9717a8d52d..5ba56327dd 100644
--- a/qga/commands-win32.c
+++ b/qga/commands-win32.c
@@ -1322,9 +1322,16 @@ void qmp_guest_suspend_disk(Error **errp)
*mode = GUEST_SUSPEND_MODE_DISK;
check_suspend_mode(*mode, &local_err);
+ if (local_err) {
+ goto out;
+ }
acquire_privilege(SE_SHUTDOWN_NAME, &local_err);
+ if (local_err) {
+ goto out;
+ }
execute_async(do_suspend, mode, &local_err);
+out:
if (local_err) {
error_propagate(errp, local_err);
g_free(mode);
@@ -1338,9 +1345,16 @@ void qmp_guest_suspend_ram(Error **errp)
*mode = GUEST_SUSPEND_MODE_RAM;
check_suspend_mode(*mode, &local_err);
+ if (local_err) {
+ goto out;
+ }
acquire_privilege(SE_SHUTDOWN_NAME, &local_err);
+ if (local_err) {
+ goto out;
+ }
execute_async(do_suspend, mode, &local_err);
+out:
if (local_err) {
error_propagate(errp, local_err);
g_free(mode);