Index: sbin/fsck_ffs/fsck.h =================================================================== --- sbin/fsck_ffs/fsck.h +++ sbin/fsck_ffs/fsck.h @@ -364,6 +364,7 @@ #define FOUND 0x10 #define EEXIT 8 /* Standard error exit. */ +#define ERERUN 16 /* fsck needs to be re-run. */ #define ERESTART -1 int flushentry(void); Index: sbin/fsck_ffs/fsck_ffs.8 =================================================================== --- sbin/fsck_ffs/fsck_ffs.8 +++ sbin/fsck_ffs/fsck_ffs.8 @@ -29,7 +29,7 @@ .\" @(#)fsck.8 8.4 (Berkeley) 5/9/95 .\" $FreeBSD$ .\" -.Dd February 14, 2017 +.Dd January 11, 2018 .Dt FSCK_FFS 8 .Os .Sh NAME @@ -376,11 +376,41 @@ .Sh EXIT STATUS .Ex -std .Pp -If the option +Specific non-zero exit status values used are: +.Bl -tag -width indent +.It 1 +Usage error (missing or invalid command arguments). +.It 2 +The +.Fl p +option was used and a SIGQUIT was received, indicating that the system +should be returned to single user mode after the file system check. +.It 3 +The file system superblock cannot be read. +This could indicate that the file system device does not exist or is not yet +ready. +.It 4 +A mounted file system was modified; the system should be rebooted. +.It 5 +The +.Fl B +option was used and soft updates are not enabled on the file system. +.It 6 +The +.Fl B +option was used and the kernel lacks needed support. +.It 7 +The .Fl F -is used, +option was used and the file system is clean. +.It 8 +General error exit. +.It 16 +The file system could not be completely repaired. +The file system may be able to be repaired by running .Nm -exits 7 if the file system is clean. +on the file system again. +.El .Sh DIAGNOSTICS The diagnostics produced by .Nm Index: sbin/fsck_ffs/main.c =================================================================== --- sbin/fsck_ffs/main.c +++ sbin/fsck_ffs/main.c @@ -82,6 +82,7 @@ int ch; struct rlimit rlimit; struct itimerval itimerval; + int fsret; int ret = 0; sync(); @@ -196,8 +197,9 @@ (void)setrlimit(RLIMIT_DATA, &rlimit); } while (argc > 0) { - if (checkfilesys(*argv) == ERESTART) + if ((fsret = checkfilesys(*argv)) == ERESTART) continue; + ret |= fsret; argc--; argv++; } @@ -585,7 +587,7 @@ sync(); return (4); } - return (0); + return (rerun ? ERERUN : 0); } static int