Yet another cleaner bugfix.
[bluesky.git] / bluesky / cleaner.c
index bd2b7f2..a892e72 100644 (file)
@@ -157,7 +157,7 @@ static BlueSkyCleanerItem *bluesky_cleaner_find_checkpoint(BlueSkyFS *fs)
 
     BlueSkyCleanerItem *checkpoint = bluesky_cleaner_deserialize(data);
     checkpoint->location.directory = BLUESKY_CLOUD_DIR_CLEANER;
-    checkpoint->location.directory = seq;
+    checkpoint->location.sequence = seq;
     bluesky_string_unref(data);
 
     return checkpoint;
@@ -303,6 +303,12 @@ void bluesky_cleaner_merge(BlueSkyFS *fs)
         return;
     }
 
+    if (checkpoint->type != LOGTYPE_CHECKPOINT) {
+        g_warning("Last cleaner object not a checkpoint; cleaning probably in progress.");
+        bluesky_cleaner_item_free(checkpoint);
+        return;
+    }
+
     /* Iterate over each of the inode map sections in the checkpoint */
     for (int i = 0; i < checkpoint->links->len; i++) {
         BlueSkyCleanerLink *link = &g_array_index(checkpoint->links,