From: Andre Noll Date: Sat, 11 Jul 2009 19:39:27 +0000 (+0200) Subject: fsck: Overwrite the backup index file if it exists. X-Git-Tag: v0.1.0~26 X-Git-Url: http://git.tuebingen.mpg.de/?p=osl.git;a=commitdiff_plain;h=edb632b26c12a94fb7d8a7bfcb787a8df8b77a1c 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. --- 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;