summaryrefslogtreecommitdiff
path: root/block/qcow2-snapshot.c
diff options
context:
space:
mode:
authorMax Reitz <mreitz@redhat.com>2013-10-09 14:42:47 +0200
committerKevin Wolf <kwolf@redhat.com>2013-10-11 16:50:00 +0200
commit00c49b21e7af1dd8d2167c1b019619ac186dad14 (patch)
tree04c2d5dbc1cd0a15e143ec8fe7bc6e40a7b76353 /block/qcow2-snapshot.c
parent84757f7e67cda3df8b04e06fbdeecc266415d2f3 (diff)
downloadqemu-00c49b21e7af1dd8d2167c1b019619ac186dad14.tar.gz
qcow2: Use better type for numerical snapshot ID
When trying to find a new snapshot ID, the existing ones are converted to integers using strtoul. This function returns an unsigned long, therefore its result should be saved in an unsigned long as well. Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/qcow2-snapshot.c')
-rw-r--r--block/qcow2-snapshot.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/block/qcow2-snapshot.c b/block/qcow2-snapshot.c
index fe7e14cc89..884b06d9fe 100644
--- a/block/qcow2-snapshot.c
+++ b/block/qcow2-snapshot.c
@@ -292,7 +292,8 @@ static void find_new_snapshot_id(BlockDriverState *bs,
{
BDRVQcowState *s = bs->opaque;
QCowSnapshot *sn;
- int i, id, id_max = 0;
+ int i;
+ unsigned long id, id_max = 0;
for(i = 0; i < s->nb_snapshots; i++) {
sn = s->snapshots + i;
@@ -300,7 +301,7 @@ static void find_new_snapshot_id(BlockDriverState *bs,
if (id > id_max)
id_max = id;
}
- snprintf(id_str, id_str_size, "%d", id_max + 1);
+ snprintf(id_str, id_str_size, "%lu", id_max + 1);
}
static int find_snapshot_by_id_and_name(BlockDriverState *bs,