about summary refs log tree commit diff
path: root/src/libstore/profiles.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstore/profiles.cc')
-rw-r--r--src/libstore/profiles.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libstore/profiles.cc b/src/libstore/profiles.cc
index 44c3c6e0d478..b43ec66f60c7 100644
--- a/src/libstore/profiles.cc
+++ b/src/libstore/profiles.cc
@@ -159,7 +159,6 @@ void deleteGenerations(const Path & profile, const std::set<unsigned int> & 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);
     }
 }