summaryrefslogtreecommitdiff
path: root/qga/commands.c
diff options
context:
space:
mode:
Diffstat (limited to 'qga/commands.c')
-rw-r--r--qga/commands.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/qga/commands.c b/qga/commands.c
index f8852beb9c..4471a9f08d 100644
--- a/qga/commands.c
+++ b/qga/commands.c
@@ -482,10 +482,15 @@ done:
* the guest's SEEK_ constants. */
int ga_parse_whence(GuestFileWhence *whence, Error **errp)
{
- /* Exploit the fact that we picked values to match QGA_SEEK_*. */
+ /*
+ * Exploit the fact that we picked values to match QGA_SEEK_*;
+ * however, we have to use a temporary variable since the union
+ * members may have different size.
+ */
if (whence->type == QTYPE_QSTRING) {
+ int value = whence->u.name;
whence->type = QTYPE_QNUM;
- whence->u.value = whence->u.name;
+ whence->u.value = value;
}
switch (whence->u.value) {
case QGA_SEEK_SET: