Subject: change fsck_ffs exit status when not -p ?
To: None <tech-userlevel@netbsd.org>
From: Darrin B.Jewell <dbj@netbsd.org>
List: tech-userlevel
Date: 10/08/2004 13:41:06
--=-=-=


I would like to commit the following change to fsck_ffs which will
cause it to return a non-zero exit status when there are unresolved
filesystem inconsistencies, but that fsck was not ran with -p.  This
occurs if, for example, -n was used or "no" was answered to repair
questions.


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment; filename=fsck.exit.diff
Content-Description: patch to exit nonzero if \"no\" answers given

Index: main.c
===================================================================
RCS file: /u3/n/rsync/cvsroot/src/sbin/fsck_ffs/main.c,v
retrieving revision 1.51
diff -u -u -r1.51 main.c
--- main.c	25 Jun 2004 14:50:15 -0000	1.51
+++ main.c	8 Oct 2004 17:34:52 -0000
@@ -367,6 +367,10 @@
 	free(inostathead);
 	inostathead = NULL;
 
+	if (!resolved || rerun) {
+		pwarn("\n***** UNRESOLVED INCONSISTENCIES REMAIN *****\n");
+		returntosingle = 1;
+	}
 	if (!fsmodified)
 		return (0);
 	if (!preen)

--=-=-=



With this patch, 'fsck -nf' can be used to determine whether a
filesystem is really clean or not.

Any objections?  Does anything currently rely on exit status when
using -n ?

Darrin

--=-=-=--