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

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