cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-vmdk-Fix-x-to-PRIx32-in-format-strings-for-cid.patch

9ae3a8
From 6ddebaea406a462feec3ce5a3c04a19223ffc218 Mon Sep 17 00:00:00 2001
9ae3a8
Message-Id: <6ddebaea406a462feec3ce5a3c04a19223ffc218.1418766606.git.jen@redhat.com>
9ae3a8
In-Reply-To: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com>
9ae3a8
References: <6f81b4847eb68ebdf54a8f1a771e19d112d74152.1418766606.git.jen@redhat.com>
9ae3a8
From: Fam Zheng <famz@redhat.com>
9ae3a8
Date: Thu, 4 Dec 2014 00:05:11 -0600
9ae3a8
Subject: [CHANGE 17/31] vmdk: Fix "%x" to PRIx32 in format strings for cid
9ae3a8
To: rhvirt-patches@redhat.com,
9ae3a8
    jen@redhat.com
9ae3a8
9ae3a8
RH-Author: Fam Zheng <famz@redhat.com>
9ae3a8
Message-id: <1417651524-18041-18-git-send-email-famz@redhat.com>
9ae3a8
Patchwork-id: 62690
9ae3a8
O-Subject: [RHEL-7.1 qemu-kvm PATCH v5 17/30] vmdk: Fix "%x" to PRIx32 in format strings for cid
9ae3a8
Bugzilla: 1134251
9ae3a8
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
9ae3a8
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
9ae3a8
RH-Acked-by: Max Reitz <mreitz@redhat.com>
9ae3a8
9ae3a8
Signed-off-by: Fam Zheng <famz@redhat.com>
9ae3a8
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9ae3a8
(cherry picked from commit 9b17031ac4efcf7a587f0e4eea82287a5329b6e7)
9ae3a8
Signed-off-by: Fam Zheng <famz@redhat.com>
9ae3a8
Signed-off-by: Jeff E. Nelson <jen@redhat.com>
9ae3a8
---
9ae3a8
 block/vmdk.c | 10 +++++-----
9ae3a8
 1 file changed, 5 insertions(+), 5 deletions(-)
9ae3a8
9ae3a8
diff --git a/block/vmdk.c b/block/vmdk.c
9ae3a8
index 0a01a2b..4cd2795 100644
9ae3a8
--- a/block/vmdk.c
9ae3a8
+++ b/block/vmdk.c
9ae3a8
@@ -262,7 +262,7 @@ static uint32_t vmdk_read_cid(BlockDriverState *bs, int parent)
9ae3a8
     p_name = strstr(desc, cid_str);
9ae3a8
     if (p_name != NULL) {
9ae3a8
         p_name += cid_str_size;
9ae3a8
-        sscanf(p_name, "%x", &cid;;
9ae3a8
+        sscanf(p_name, "%" SCNx32, &cid;;
9ae3a8
     }
9ae3a8
 
9ae3a8
     return cid;
9ae3a8
@@ -290,7 +290,7 @@ static int vmdk_write_cid(BlockDriverState *bs, uint32_t cid)
9ae3a8
     p_name = strstr(desc, "CID");
9ae3a8
     if (p_name != NULL) {
9ae3a8
         p_name += sizeof("CID");
9ae3a8
-        snprintf(p_name, sizeof(desc) - (p_name - desc), "%x\n", cid);
9ae3a8
+        snprintf(p_name, sizeof(desc) - (p_name - desc), "%" PRIx32 "\n", cid);
9ae3a8
         pstrcat(desc, sizeof(desc), tmp_desc);
9ae3a8
     }
9ae3a8
 
9ae3a8
@@ -1705,8 +1705,8 @@ static int vmdk_create(const char *filename, QEMUOptionParameter *options,
9ae3a8
     const char desc_template[] =
9ae3a8
         "# Disk DescriptorFile\n"
9ae3a8
         "version=1\n"
9ae3a8
-        "CID=%x\n"
9ae3a8
-        "parentCID=%x\n"
9ae3a8
+        "CID=%" PRIx32 "\n"
9ae3a8
+        "parentCID=%" PRIx32 "\n"
9ae3a8
         "createType=\"%s\"\n"
9ae3a8
         "%s"
9ae3a8
         "\n"
9ae3a8
@@ -1848,7 +1848,7 @@ static int vmdk_create(const char *filename, QEMUOptionParameter *options,
9ae3a8
     }
9ae3a8
     /* generate descriptor file */
9ae3a8
     desc = g_strdup_printf(desc_template,
9ae3a8
-                           (unsigned int)time(NULL),
9ae3a8
+                           (uint32_t)time(NULL),
9ae3a8
                            parent_cid,
9ae3a8
                            fmt,
9ae3a8
                            parent_desc_line,
9ae3a8
-- 
9ae3a8
2.1.0
9ae3a8