about summary refs log tree commit diff
path: root/src/libstore
diff options
context:
space:
mode:
authorMatthew O'Gorman <mog@rldn.net>2018-03-02T03·22-0500
committerMatthew O'Gorman <mog@rldn.net>2018-03-02T03·22-0500
commit3c16044cb0acc87e128534cb3e2a2006b71059b6 (patch)
tree90891432fc4dcb719cbff6c177c265ea55a36a39 /src/libstore
parent12fe2249e1b32dc9033e2680017a4c7f236edaac (diff)
remove unused variable and make sure to check that the current
generation is not the one we are deleting
Diffstat (limited to 'src/libstore')
-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);
     }
 }