From 3c16044cb0acc87e128534cb3e2a2006b71059b6 Mon Sep 17 00:00:00 2001 From: Matthew O'Gorman Date: Thu, 1 Mar 2018 22:22:02 -0500 Subject: [PATCH] remove unused variable and make sure to check that the current generation is not the one we are deleting --- src/libstore/profiles.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libstore/profiles.cc b/src/libstore/profiles.cc index 44c3c6e0d..b43ec66f6 100644 --- a/src/libstore/profiles.cc +++ b/src/libstore/profiles.cc @@ -159,7 +159,6 @@ void deleteGenerations(const Path & profile, const std::set & gens void deleteGenerationsGreaterThan(const Path & profile, int max, bool dryRun) { - int max_keep = 0; PathLocks lock; lockProfile(lock, profile); @@ -172,7 +171,8 @@ void deleteGenerationsGreaterThan(const Path & profile, int max, bool dryRun) max--; continue; } - deleteGeneration2(profile, i->number, dryRun); + if (i->number != curGen) + deleteGeneration2(profile, i->number, dryRun); } }