diff --git a/include/Snapshots.h b/include/Snapshots.h index 054ca380b4..9b4198b9e8 100644 --- a/include/Snapshots.h +++ b/include/Snapshots.h @@ -131,7 +131,7 @@ private: /** * Id of the active (current) snapshot, 0 represents the base image */ - unsigned int active; + int active; /** * Id of the disk associated with this snapshot list diff --git a/src/vm/Snapshots.cc b/src/vm/Snapshots.cc index 75c370aea1..cdad2ef2ba 100644 --- a/src/vm/Snapshots.cc +++ b/src/vm/Snapshots.cc @@ -145,19 +145,16 @@ int Snapshots::active_snapshot(unsigned int id, string& error) return 0; } - if ( id != 0 ) + snapshot = get_snapshot(id); + + if (snapshot == 0) { - snapshot = get_snapshot(id); - - if (snapshot == 0) - { - error = "Snapshot does not exists"; - return -1; - } - - snapshot->replace("ACTIVE", true); + error = "Snapshot does not exists"; + return -1; } + snapshot->replace("ACTIVE", true); + snapshot = get_snapshot(active); if (snapshot != 0)