summaryrefslogtreecommitdiff
path: root/bin/dd
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 /bin/dd
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 'bin/dd')
-rw-r--r--bin/dd/conv.c8
-rw-r--r--bin/dd/dd.c8
2 files changed, 10 insertions, 6 deletions
diff --git a/bin/dd/conv.c b/bin/dd/conv.c
index ba005a3e155..16aa5f1b8f3 100644
--- a/bin/dd/conv.c
+++ b/bin/dd/conv.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conv.c,v 1.11 2009/10/27 23:59:21 deraadt Exp $ */
+/* $OpenBSD: conv.c,v 1.12 2015/01/16 06:39:31 deraadt Exp $ */
/* $NetBSD: conv.c,v 1.6 1996/02/20 19:29:02 jtc Exp $ */
/*-
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/time.h>
#include <err.h>
@@ -43,6 +43,8 @@
#include "dd.h"
#include "extern.h"
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+
/*
* def --
* Copy input to output. Input is buffered until reaches obs, and then
@@ -137,7 +139,7 @@ block(void)
* translation is done as we copy into the output buffer.
*/
for (inp = in.dbp - in.dbcnt, outp = out.dbp; in.dbcnt;) {
- maxlen = MIN(cbsz, in.dbcnt);
+ maxlen = MINIMUM(cbsz, in.dbcnt);
if ((t = ctab) != NULL)
for (cnt = 0;
cnt < maxlen && (ch = *inp++) != '\n'; ++cnt)
diff --git a/bin/dd/dd.c b/bin/dd/dd.c
index 23f9608aec1..715a1aa79fd 100644
--- a/bin/dd/dd.c
+++ b/bin/dd/dd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dd.c,v 1.20 2015/01/05 13:52:47 tedu Exp $ */
+/* $OpenBSD: dd.c,v 1.21 2015/01/16 06:39:31 deraadt Exp $ */
/* $NetBSD: dd.c,v 1.6 1996/02/20 19:29:06 jtc Exp $ */
/*-
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*/
-#include <sys/param.h>
+#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <sys/mtio.h>
@@ -57,6 +57,8 @@ static void dd_in(void);
static void getfdtype(IO *);
static void setup(void);
+#define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b))
+
IO in, out; /* input/output state */
STAT st; /* statistics */
void (*cfunc)(void); /* conversion function */
@@ -135,7 +137,7 @@ setup(void)
err(1, "input buffer");
out.db = in.db;
} else if ((in.db =
- malloc((u_int)(MAX(in.dbsz, cbsz) + cbsz))) == NULL ||
+ malloc((u_int)(MAXIMUM(in.dbsz, cbsz) + cbsz))) == NULL ||
(out.db = malloc((u_int)(out.dbsz + cbsz))) == NULL)
err(1, "output buffer");
in.dbp = in.db;