diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2015-01-16 06:40:24 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2015-01-16 06:40:24 +0000 |
commit | 315054f4737a39489e0a14f3a92bff61f1592832 (patch) | |
tree | 62bf010653374ce09b6beb4dfa0414a91457233b /sbin/fsck_ffs/setup.c | |
parent | 79e3d817585ca08a91e30ad14abe43e2ab70295f (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_ffs/setup.c')
-rw-r--r-- | sbin/fsck_ffs/setup.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/sbin/fsck_ffs/setup.c b/sbin/fsck_ffs/setup.c index 68290caaa5c..91bfb782368 100644 --- a/sbin/fsck_ffs/setup.c +++ b/sbin/fsck_ffs/setup.c @@ -1,4 +1,4 @@ -/* $OpenBSD: setup.c,v 1.55 2014/09/06 04:05:40 guenther Exp $ */ +/* $OpenBSD: setup.c,v 1.56 2015/01/16 06:39:57 deraadt Exp $ */ /* $NetBSD: setup.c,v 1.27 1996/09/27 22:45:19 christos Exp $ */ /* @@ -30,8 +30,8 @@ * SUCH DAMAGE. */ +#include <sys/param.h> /* MAXFRAG MAXBSIZE DEV_BSIZE roundup */ #define DKTYPENAMES -#include <sys/param.h> #include <sys/time.h> #include <ufs/ufs/dinode.h> #include <ufs/ffs/fs.h> @@ -47,12 +47,15 @@ #include <string.h> #include <util.h> #include <unistd.h> +#include <limits.h> #include <ctype.h> #include "fsck.h" #include "extern.h" #include "fsutil.h" +#define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b)) + #define altsblock (*asblk.b_un.b_fs) #define POWEROF2(num) (((num) & ((num) - 1)) == 0) @@ -61,7 +64,7 @@ int calcsb(char *, int, struct fs *); static struct disklabel *getdisklabel(char *, int); static int readsb(int); static int cmpsb(struct fs *, struct fs *); -static char rdevname[MAXPATHLEN]; +static char rdevname[PATH_MAX]; long numdirs, listmax, inplast; @@ -395,7 +398,7 @@ found: (unsigned)sblock.fs_ncg * sizeof(struct inostatlist)); goto badsblabel; } - numdirs = MAX(sblock.fs_cstotal.cs_ndir, 128); + numdirs = MAXIMUM(sblock.fs_cstotal.cs_ndir, 128); inplast = 0; listmax = numdirs + 10; inpsort = calloc((unsigned)listmax, sizeof(struct inoinfo *)); |