[ostree] core: Add --delete option for fsck



commit 00ec0ddb9b711769d1c9ace1c40a301b80d33514
Author: Colin Walters <walters verbum org>
Date:   Mon Jan 23 17:06:10 2012 -0500

    core: Add --delete option for fsck
    
    Useful to clean up any broken objects.

 src/ostree/ot-builtin-fsck.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/src/ostree/ot-builtin-fsck.c b/src/ostree/ot-builtin-fsck.c
index fcd7070..9671ffa 100644
--- a/src/ostree/ot-builtin-fsck.c
+++ b/src/ostree/ot-builtin-fsck.c
@@ -28,9 +28,11 @@
 #include <glib/gi18n.h>
 
 static gboolean quiet;
+static gboolean delete;
 
 static GOptionEntry options[] = {
   { "quiet", 'q', 0, G_OPTION_ARG_NONE, &quiet, "Don't display informational messages", NULL },
+  { "delete", 0, 0, G_OPTION_ARG_NONE, &delete, "Remove corrupted objects", NULL },
   { NULL }
 };
 
@@ -162,6 +164,8 @@ object_iter_callback (OstreeRepo    *repo,
       data->had_error = TRUE;
       g_printerr ("ERROR: corrupted object '%s'; actual checksum: %s\n",
                   ot_gfile_get_path_cached (objf), g_checksum_get_string (real_checksum));
+      if (delete)
+        (void) unlink (ot_gfile_get_path_cached (objf));
     }
 
   data->n_objects++;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]