]> Git Repo - qemu.git/commitdiff
qcow2: Use better type for numerical snapshot ID
authorMax Reitz <[email protected]>
Wed, 9 Oct 2013 12:42:47 +0000 (14:42 +0200)
committerKevin Wolf <[email protected]>
Fri, 11 Oct 2013 14:50:00 +0000 (16:50 +0200)
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 <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
block/qcow2-snapshot.c

index fe7e14cc895106255a6e94f4b0940eb4c9d76d43..884b06d9fef4e50eba3701a7e6b3907b88f5b1da 100644 (file)
@@ -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,
This page took 0.027169 seconds and 4 git commands to generate.