diff options
author | Tomáš Golembiovský | 2018-10-23 13:23:23 +0200 |
---|---|---|
committer | Michael Roth | 2018-10-31 15:04:20 +0100 |
commit | 7fae5184790680b39f4d627d069981816f4c3191 (patch) | |
tree | 8b2b386b5291f82901807ceb19847f8b331334e6 /qga | |
parent | qga-win: return disk device in guest-get-fsinfo (diff) | |
download | qemu-7fae5184790680b39f4d627d069981816f4c3191.tar.gz qemu-7fae5184790680b39f4d627d069981816f4c3191.tar.xz qemu-7fae5184790680b39f4d627d069981816f4c3191.zip |
qga-win: demystify namespace stripping
It was not obvious what exactly the cryptic string copying does to the
GUID. This change makes the intent clearer.
Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Diffstat (limited to 'qga')
-rw-r--r-- | qga/commands-win32.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/qga/commands-win32.c b/qga/commands-win32.c index 30d6c639c3..a1b7512d46 100644 --- a/qga/commands-win32.c +++ b/qga/commands-win32.c @@ -521,7 +521,7 @@ static GuestPCIAddress *get_pci_info(char *guid, Error **errp) char dev_name[MAX_PATH]; char *buffer = NULL; GuestPCIAddress *pci = NULL; - char *name = g_strdup(&guid[4]); + char *name = NULL; bool partial_pci = false; pci = g_malloc0(sizeof(*pci)); pci->domain = -1; @@ -529,6 +529,13 @@ static GuestPCIAddress *get_pci_info(char *guid, Error **errp) pci->function = -1; pci->bus = -1; + if (g_str_has_prefix(guid, "\\\\.\\") || + g_str_has_prefix(guid, "\\\\?\\")) { + name = g_strdup(guid + 4); + } else { + name = g_strdup(guid); + } + if (!QueryDosDevice(name, dev_name, ARRAY_SIZE(dev_name))) { error_setg_win32(errp, GetLastError(), "failed to get dos device name"); goto out; |