From d4a33fa1f335a750af118d81cd66ac6fc197f95e Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Sun, 7 Jan 2001 15:07:24 +0000 Subject: [PATCH] When checking/fixing bucket file structure, adjust exit code according to whether the file is clean or not. --- lib/buckettool.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/buckettool.c b/lib/buckettool.c index c93aaf51..2db4ce39 100644 --- a/lib/buckettool.c +++ b/lib/buckettool.c @@ -143,6 +143,8 @@ fsck(int fix) sh_off_t end; oid_t oid; u32 chk; + int errors = 0; + int fatal_errors = 0; fd = open(obuck_name, O_RDWR); if (fd < 0) @@ -172,12 +174,14 @@ fsck(int fix) pos = end; continue; } + errors++; end = pos; do { if (pos - end > 0x10000000) { printf("*** skipped for too long, giving up\n"); + fatal_errors++; goto finish; } end += OBUCK_ALIGN; @@ -211,6 +215,8 @@ fsck(int fix) } finish: close(fd); + if (!fix && errors || fatal_errors) + exit(1); } int -- 2.39.2