xfs_check returns success when the superblock magic is invalid - this makes it
return the serious error exit code (3) for this case, and the invalid arguments
exit code (1) if the arguments to xfs_check were wrong.
A glance at the code suggests that other xfs_check failures appear to return
the correct error codes.
Reviewed-by: Christoph Hellwig <hch@lst.de>
Cc: Michael Sinz <michael.sinz@sinz.org>
dbprintf("already have block usage information\n");
return 0;
}
- if (!init(argc, argv))
+ if (!init(argc, argv)) {
+ if (serious_error)
+ exitcode = 3;
+ else
+ exitcode = 1;
return 0;
+ }
oldprefix = dbprefix;
dbprefix |= pflag;
for (agno = 0, sbyell = 0; agno < mp->m_sb.sb_agcount; agno++) {
xfs_ino_t ino;
int rt;
+ serious_error = 0;
if (mp->m_sb.sb_magicnum != XFS_SB_MAGIC) {
dbprintf("bad superblock magic number %x, giving up\n",
mp->m_sb.sb_magicnum);
+ serious_error = 1;
return 0;
}
if (!sb_logcheck())