summaryrefslogtreecommitdiffstats
path: root/sbin/dumpfs/dumpfs.c
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2015-01-16 06:39:28 +0000
committerderaadt <deraadt@openbsd.org>2015-01-16 06:39:28 +0000
commitb9fc9a728fce9c4289b7e9a992665e28d5629a54 (patch)
tree72b2433e418dfa1aef5fcf8305617b97979a25d8 /sbin/dumpfs/dumpfs.c
parentimprove checksum parsing slightly. now handles filenames with spaces. (diff)
downloadwireguard-openbsd-b9fc9a728fce9c4289b7e9a992665e28d5629a54.tar.xz
wireguard-openbsd-b9fc9a728fce9c4289b7e9a992665e28d5629a54.zip
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/dumpfs/dumpfs.c')
-rw-r--r--sbin/dumpfs/dumpfs.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sbin/dumpfs/dumpfs.c b/sbin/dumpfs/dumpfs.c
index 7633b89fc23..f7cdb38768e 100644
--- a/sbin/dumpfs/dumpfs.c
+++ b/sbin/dumpfs/dumpfs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dumpfs.c,v 1.30 2014/05/13 12:51:40 krw Exp $ */
+/* $OpenBSD: dumpfs.c,v 1.31 2015/01/16 06:39:57 deraadt Exp $ */
/*
* Copyright (c) 2002 Networks Associates Technology, Inc.
@@ -38,7 +38,7 @@
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/param.h> /* DEV_BSIZE MAXFRAG MAXBSIZE isset */
#include <sys/time.h>
#include <ufs/ufs/dinode.h>
@@ -54,6 +54,8 @@
#include <unistd.h>
#include <util.h>
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+
union {
struct fs fs;
char pad[MAXBSIZE];
@@ -184,7 +186,7 @@ dumpfs(int fd, const char *name)
max = afs.fs_maxcontig;
size = afs.fs_contigsumsize;
if ((max < 2 && size == 0) ||
- (max > 1 && size >= MIN(max, FS_MAXCONTIG)))
+ (max > 1 && size >= MINIMUM(max, FS_MAXCONTIG)))
i++;
}
}