From edb632b26c12a94fb7d8a7bfcb787a8df8b77a1c Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sat, 11 Jul 2009 21:39:27 +0200 Subject: [PATCH] fsck: Overwrite the backup index file if it exists. A bit dangerous, but without this change, osfsck always fails if this file exists. Also, print a bit more information about what is going on. --- fsck.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fsck.c b/fsck.c index 246a0b6..bc77424 100644 --- a/fsck.c +++ b/fsck.c @@ -577,7 +577,8 @@ static int prune_objects(struct osl_table *t, uint32_t *lost_bytes) NOTICE_LOG("removing unreferenced objects from data files\n"); /* first make a copy of the index */ - ret = osl_open(old_idx_filename, O_WRONLY | O_CREAT | O_EXCL, 0644); + DEBUG_LOG("opening %s\n", old_idx_filename); + ret = osl_open(old_idx_filename, O_WRONLY | O_CREAT | O_TRUNC, 0644); if (ret < 0) goto out_free; fd = ret; @@ -1169,7 +1170,8 @@ static int check_table(char *db_dir, char *table_name) ret = dump_table(conf.dump_dir_arg, &desc); out: if (ret < 0) - ERROR_LOG("failed to check table %s\n", table_name); + ERROR_LOG("failed to check table %s: %s\n", table_name, + fsck_strerror(-ret)); else NOTICE_LOG("successfully checked table %s\n", table_name); return ret; -- 2.39.2