]> mj.ucw.cz Git - libucw.git/commitdiff
When checking/fixing bucket file structure, adjust exit code according
authorMartin Mares <mj@ucw.cz>
Sun, 7 Jan 2001 15:07:24 +0000 (15:07 +0000)
committerMartin Mares <mj@ucw.cz>
Sun, 7 Jan 2001 15:07:24 +0000 (15:07 +0000)
to whether the file is clean or not.

lib/buckettool.c

index c93aaf51d2f3c75c053b65f613f2a44dce2ad2f7..2db4ce3944103923fe512dbaa125ccab938e0191 100644 (file)
@@ -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