summary refs log tree commit diff stats
path: root/util/oslib-win32.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2020-07-14 21:21:58 +0100
committerPeter Maydell <peter.maydell@linaro.org>2020-07-14 21:21:58 +0100
commitc920fdba39480989cb5f1af3cc63acccef021b54 (patch)
treea19a5c8002b47dfc1320b46e83aea052bd4c21d5 /util/oslib-win32.c
parent8bfa25a46ff1082f75e7052875b5d435119dcf49 (diff)
parent0d3a8f32b1e0eca279da1b0cc793efc7250c3daf (diff)
downloadfocaccia-qemu-c920fdba39480989cb5f1af3cc63acccef021b54.tar.gz
focaccia-qemu-c920fdba39480989cb5f1af3cc63acccef021b54.zip
Merge remote-tracking branch 'remotes/mdroth/tags/qga-pull-2020-07-13-tag' into staging
qemu-ga patch queue for hard-freeze

* fix erroneously reporting stale hostname in guest-get-host-name
* fix regression where guest-shutdown asserts when called
* fix race condition with guest-fs-freeze/thaw on w32

# gpg: Signature made Tue 14 Jul 2020 05:47:11 BST
# gpg:                using RSA key CEACC9E15534EBABB82D3FA03353C9CEF108B584
# gpg:                issuer "mdroth@linux.vnet.ibm.com"
# gpg: Good signature from "Michael Roth <flukshun@gmail.com>" [full]
# gpg:                 aka "Michael Roth <mdroth@utexas.edu>" [full]
# gpg:                 aka "Michael Roth <mdroth@linux.vnet.ibm.com>" [full]
# Primary key fingerprint: CEAC C9E1 5534 EBAB B82D  3FA0 3353 C9CE F108 B584

* remotes/mdroth/tags/qga-pull-2020-07-13-tag:
  qga: Use qemu_get_host_name() instead of g_get_host_name()
  util: Introduce qemu_get_host_name()
  qga: fix assert regression on guest-shutdown
  qga-win: Fix QGA VSS Provider service stop failure

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'util/oslib-win32.c')
-rw-r--r--util/oslib-win32.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/util/oslib-win32.c b/util/oslib-win32.c
index e9b14ab178..3b49d27297 100644
--- a/util/oslib-win32.c
+++ b/util/oslib-win32.c
@@ -808,3 +808,16 @@ bool qemu_write_pidfile(const char *filename, Error **errp)
     }
     return true;
 }
+
+char *qemu_get_host_name(Error **errp)
+{
+    wchar_t tmp[MAX_COMPUTERNAME_LENGTH + 1];
+    DWORD size = G_N_ELEMENTS(tmp);
+
+    if (GetComputerNameW(tmp, &size) == 0) {
+        error_setg_win32(errp, GetLastError(), "failed close handle");
+        return NULL;
+    }
+
+    return g_utf16_to_utf8(tmp, size, NULL, NULL, NULL);
+}