summaryrefslogtreecommitdiffstats
path: root/sbin/dump/tape.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/dump/tape.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/dump/tape.c')
-rw-r--r--sbin/dump/tape.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/sbin/dump/tape.c b/sbin/dump/tape.c
index 14b4df1602d..ddecaecda36 100644
--- a/sbin/dump/tape.c
+++ b/sbin/dump/tape.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tape.c,v 1.40 2014/06/13 20:43:06 naddy Exp $ */
+/* $OpenBSD: tape.c,v 1.41 2015/01/16 06:39:57 deraadt Exp $ */
/* $NetBSD: tape.c,v 1.11 1997/06/05 11:13:26 lukem Exp $ */
/*-
@@ -30,8 +30,7 @@
* SUCH DAMAGE.
*/
-#include <sys/types.h>
-#include <sys/param.h>
+#include <sys/param.h> /* MAXFRAG MAXBSIZE DEV_BSIZE */
#include <sys/socket.h>
#include <sys/time.h>
#include <sys/wait.h>
@@ -49,10 +48,13 @@
#include <string.h>
#include <time.h>
#include <unistd.h>
+#include <limits.h>
#include "dump.h"
#include "pathnames.h"
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+
int writesize; /* size of malloc()ed buffer for tape */
int64_t lastspclrec = -1; /* tape block number of last written header */
int trecno = 0; /* next record to write in current block */
@@ -175,7 +177,7 @@ dumpblock(daddr_t blkno, int size)
dblkno = fsbtodb(sblock, blkno);
tpblks = size >> tp_bshift;
- while ((avail = MIN(tpblks, ntrec - trecno)) > 0) {
+ while ((avail = MINIMUM(tpblks, ntrec - trecno)) > 0) {
slp->req[trecno].dblk = dblkno;
slp->req[trecno].count = avail;
trecno += avail;