summaryrefslogtreecommitdiff
path: root/sbin/fsck_ext2fs
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2015-01-16 06:40:24 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2015-01-16 06:40:24 +0000
commit315054f4737a39489e0a14f3a92bff61f1592832 (patch)
tree62bf010653374ce09b6beb4dfa0414a91457233b /sbin/fsck_ext2fs
parent79e3d817585ca08a91e30ad14abe43e2ab70295f (diff)
Replace <sys/param.h> with <limits.h> and other less dirty headers where
possible. Annotate <sys/param.h> lines with their current reasons. Switch to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where sensible to avoid pulling in the pollution. These are the files confirmed through binary verification. ok guenther, millert, doug (helped with the verification protocol)
Diffstat (limited to 'sbin/fsck_ext2fs')
-rw-r--r--sbin/fsck_ext2fs/dir.c9
-rw-r--r--sbin/fsck_ext2fs/inode.c9
-rw-r--r--sbin/fsck_ext2fs/main.c5
-rw-r--r--sbin/fsck_ext2fs/pass1.c4
-rw-r--r--sbin/fsck_ext2fs/pass1b.c3
-rw-r--r--sbin/fsck_ext2fs/pass2.c11
-rw-r--r--sbin/fsck_ext2fs/pass3.c3
-rw-r--r--sbin/fsck_ext2fs/pass4.c4
-rw-r--r--sbin/fsck_ext2fs/pass5.c4
-rw-r--r--sbin/fsck_ext2fs/setup.c4
-rw-r--r--sbin/fsck_ext2fs/utilities.c5
11 files changed, 32 insertions, 29 deletions
diff --git a/sbin/fsck_ext2fs/dir.c b/sbin/fsck_ext2fs/dir.c
index cda8b6f3c9d..9864bacd0d3 100644
--- a/sbin/fsck_ext2fs/dir.c
+++ b/sbin/fsck_ext2fs/dir.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dir.c,v 1.19 2014/07/13 16:08:53 pelikan Exp $ */
+/* $OpenBSD: dir.c,v 1.20 2015/01/16 06:39:57 deraadt Exp $ */
/* $NetBSD: dir.c,v 1.5 2000/01/28 16:01:46 bouyer Exp $ */
/*
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* DEV_BSIZE roundup */
#include <sys/time.h>
#include <ufs/ufs/dir.h>
#include <ufs/ext2fs/ext2fs_dinode.h>
@@ -43,6 +43,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <limits.h>
#include "fsck.h"
#include "fsutil.h"
@@ -256,7 +257,7 @@ void
fileerror(ino_t cwd, ino_t ino, char *errmesg)
{
struct ext2fs_dinode *dp;
- char pathbuf[MAXPATHLEN + 1];
+ char pathbuf[PATH_MAX + 1];
pwarn("%s ", errmesg);
pinode(ino);
@@ -480,7 +481,7 @@ makeentry(ino_t parent, ino_t ino, char *name)
{
struct ext2fs_dinode *dp;
struct inodesc idesc;
- char pathbuf[MAXPATHLEN + 1];
+ char pathbuf[PATH_MAX + 1];
if ((parent < EXT2_FIRSTINO && parent != EXT2_ROOTINO)
|| parent >= maxino ||
diff --git a/sbin/fsck_ext2fs/inode.c b/sbin/fsck_ext2fs/inode.c
index 9327388906e..f3a78a8750d 100644
--- a/sbin/fsck_ext2fs/inode.c
+++ b/sbin/fsck_ext2fs/inode.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: inode.c,v 1.24 2014/10/29 06:31:58 deraadt Exp $ */
+/* $OpenBSD: inode.c,v 1.25 2015/01/16 06:39:57 deraadt Exp $ */
/* $NetBSD: inode.c,v 1.8 2000/01/28 16:01:46 bouyer Exp $ */
/*
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* btodb */
#include <sys/time.h>
#include <ufs/ext2fs/ext2fs_dinode.h>
#include <ufs/ext2fs/ext2fs_dir.h>
@@ -45,6 +45,7 @@
#include <stdlib.h>
#include <string.h>
#include <time.h>
+#include <limits.h>
#include "fsck.h"
#include "fsutil.h"
@@ -118,7 +119,7 @@ ckinode(struct ext2fs_dinode *dp, struct inodesc *idesc)
struct ext2fs_dinode dino;
u_int64_t remsize, sizepb;
mode_t mode;
- char pathbuf[MAXPATHLEN + 1];
+ char pathbuf[PATH_MAX + 1];
if (idesc->id_fix != IGNORE)
idesc->id_fix = DONTKNOW;
@@ -204,7 +205,7 @@ iblock(struct inodesc *idesc, long ilevel, u_int64_t isize)
int i, n, (*func)(struct inodesc *), nif;
u_int64_t sizepb;
char buf[BUFSIZ];
- char pathbuf[MAXPATHLEN + 1];
+ char pathbuf[PATH_MAX + 1];
struct ext2fs_dinode *dp;
if (idesc->id_type == ADDR) {
diff --git a/sbin/fsck_ext2fs/main.c b/sbin/fsck_ext2fs/main.c
index 830379dff03..1db5abfe35e 100644
--- a/sbin/fsck_ext2fs/main.c
+++ b/sbin/fsck_ext2fs/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.20 2014/05/21 17:52:26 krw Exp $ */
+/* $OpenBSD: main.c,v 1.21 2015/01/16 06:39:57 deraadt Exp $ */
/* $NetBSD: main.c,v 1.1 1997/06/11 11:21:50 bouyer Exp $ */
/*
@@ -31,7 +31,8 @@
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/types.h>
+#include <sys/signal.h>
#include <sys/time.h>
#include <sys/mount.h>
#include <ufs/ext2fs/ext2fs_dinode.h>
diff --git a/sbin/fsck_ext2fs/pass1.c b/sbin/fsck_ext2fs/pass1.c
index 6f463e9bf57..608d45e3f37 100644
--- a/sbin/fsck_ext2fs/pass1.c
+++ b/sbin/fsck_ext2fs/pass1.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pass1.c,v 1.14 2014/07/13 16:08:53 pelikan Exp $ */
+/* $OpenBSD: pass1.c,v 1.15 2015/01/16 06:39:57 deraadt Exp $ */
/* $NetBSD: pass1.c,v 1.9 2000/01/31 11:40:12 bouyer Exp $ */
/*
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* setbit btodb isset */
#include <sys/time.h>
#include <ufs/ext2fs/ext2fs_dinode.h>
#include <ufs/ext2fs/ext2fs_dir.h>
diff --git a/sbin/fsck_ext2fs/pass1b.c b/sbin/fsck_ext2fs/pass1b.c
index e650e2f4920..1e30f194188 100644
--- a/sbin/fsck_ext2fs/pass1b.c
+++ b/sbin/fsck_ext2fs/pass1b.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pass1b.c,v 1.8 2011/03/12 17:50:47 deraadt Exp $ */
+/* $OpenBSD: pass1b.c,v 1.9 2015/01/16 06:39:57 deraadt Exp $ */
/* $NetBSD: pass1b.c,v 1.2 1997/09/14 14:27:26 lukem Exp $ */
/*
@@ -31,7 +31,6 @@
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/time.h>
#include <ufs/ext2fs/ext2fs_dinode.h>
#include <ufs/ext2fs/ext2fs.h>
diff --git a/sbin/fsck_ext2fs/pass2.c b/sbin/fsck_ext2fs/pass2.c
index 81d06949b37..b568d0888e5 100644
--- a/sbin/fsck_ext2fs/pass2.c
+++ b/sbin/fsck_ext2fs/pass2.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pass2.c,v 1.13 2014/07/13 16:08:53 pelikan Exp $ */
+/* $OpenBSD: pass2.c,v 1.14 2015/01/16 06:39:57 deraadt Exp $ */
/* $NetBSD: pass2.c,v 1.6 2000/01/28 16:01:46 bouyer Exp $ */
/*
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* roundup */
#include <sys/time.h>
#include <ufs/ext2fs/ext2fs_dinode.h>
#include <ufs/ext2fs/ext2fs_dir.h>
@@ -42,6 +42,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <limits.h>
#include "fsck.h"
#include "fsutil.h"
@@ -60,7 +61,7 @@ pass2(void)
struct inoinfo **inpend;
struct inodesc curino;
struct ext2fs_dinode dino;
- char pathbuf[MAXPATHLEN + 1];
+ char pathbuf[PATH_MAX + 1];
switch (statemap[EXT2_ROOTINO]) {
@@ -196,8 +197,8 @@ pass2check(struct inodesc *idesc)
struct ext2fs_dinode *dp;
char *errmsg;
struct ext2fs_direct proto;
- char namebuf[MAXPATHLEN + 1];
- char pathbuf[MAXPATHLEN + 1];
+ char namebuf[PATH_MAX + 1];
+ char pathbuf[PATH_MAX + 1];
/*
* check for "."
diff --git a/sbin/fsck_ext2fs/pass3.c b/sbin/fsck_ext2fs/pass3.c
index 5de22eb2c4f..1f857e36096 100644
--- a/sbin/fsck_ext2fs/pass3.c
+++ b/sbin/fsck_ext2fs/pass3.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pass3.c,v 1.6 2003/06/11 06:22:13 deraadt Exp $ */
+/* $OpenBSD: pass3.c,v 1.7 2015/01/16 06:39:57 deraadt Exp $ */
/* $NetBSD: pass3.c,v 1.2 1997/09/14 14:27:28 lukem Exp $ */
/*
@@ -31,7 +31,6 @@
* SUCH DAMAGE.
*/
-#include <sys/param.h>
#include <sys/time.h>
#include <ufs/ext2fs/ext2fs_dinode.h>
#include <ufs/ext2fs/ext2fs.h>
diff --git a/sbin/fsck_ext2fs/pass4.c b/sbin/fsck_ext2fs/pass4.c
index f85ef044a23..6956a7d257d 100644
--- a/sbin/fsck_ext2fs/pass4.c
+++ b/sbin/fsck_ext2fs/pass4.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pass4.c,v 1.9 2013/04/24 13:46:27 deraadt Exp $ */
+/* $OpenBSD: pass4.c,v 1.10 2015/01/16 06:39:57 deraadt Exp $ */
/* $NetBSD: pass4.c,v 1.2 1997/09/14 14:27:29 lukem Exp $ */
/*
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* isset clrbit */
#include <sys/time.h>
#include <ufs/ext2fs/ext2fs_dinode.h>
#include <ufs/ext2fs/ext2fs.h>
diff --git a/sbin/fsck_ext2fs/pass5.c b/sbin/fsck_ext2fs/pass5.c
index 151bda78aa3..2ea1327cf81 100644
--- a/sbin/fsck_ext2fs/pass5.c
+++ b/sbin/fsck_ext2fs/pass5.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pass5.c,v 1.17 2014/07/13 16:08:53 pelikan Exp $ */
+/* $OpenBSD: pass5.c,v 1.18 2015/01/16 06:39:57 deraadt Exp $ */
/* $NetBSD: pass5.c,v 1.7 2000/01/28 16:01:46 bouyer Exp $ */
/*
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* setbit isset */
#include <sys/time.h>
#include <ufs/ufs/dinode.h>
#include <ufs/ext2fs/ext2fs_dinode.h>
diff --git a/sbin/fsck_ext2fs/setup.c b/sbin/fsck_ext2fs/setup.c
index b4c2f9d9204..7f2404f5f28 100644
--- a/sbin/fsck_ext2fs/setup.c
+++ b/sbin/fsck_ext2fs/setup.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: setup.c,v 1.24 2014/11/20 15:22:39 tedu Exp $ */
+/* $OpenBSD: setup.c,v 1.25 2015/01/16 06:39:57 deraadt Exp $ */
/* $NetBSD: setup.c,v 1.1 1997/06/11 11:22:01 bouyer Exp $ */
/*
@@ -32,7 +32,7 @@
*/
#define DKTYPENAMES
-#include <sys/param.h>
+#include <sys/param.h> /* DEV_BSIZE roundup */
#include <sys/time.h>
#include <ufs/ext2fs/ext2fs_dinode.h>
#include <ufs/ext2fs/ext2fs.h>
diff --git a/sbin/fsck_ext2fs/utilities.c b/sbin/fsck_ext2fs/utilities.c
index 7601ec6ea76..3eb2daa4753 100644
--- a/sbin/fsck_ext2fs/utilities.c
+++ b/sbin/fsck_ext2fs/utilities.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: utilities.c,v 1.23 2014/07/13 16:08:53 pelikan Exp $ */
+/* $OpenBSD: utilities.c,v 1.24 2015/01/16 06:39:57 deraadt Exp $ */
/* $NetBSD: utilities.c,v 1.6 2001/02/04 21:19:34 christos Exp $ */
/*
@@ -31,8 +31,9 @@
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* DEV_BSIZE isset setbit */
#include <sys/time.h>
+#include <sys/signal.h>
#include <ufs/ext2fs/ext2fs_dinode.h>
#include <ufs/ext2fs/ext2fs_dir.h>
#include <ufs/ext2fs/ext2fs.h>