summaryrefslogtreecommitdiffstats
path: root/bin/rm/rm.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 /bin/rm/rm.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 'bin/rm/rm.c')
-rw-r--r--bin/rm/rm.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/bin/rm/rm.c b/bin/rm/rm.c
index ed43f02e5b8..833d3039b97 100644
--- a/bin/rm/rm.c
+++ b/bin/rm/rm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rm.c,v 1.29 2014/05/21 06:23:02 guenther Exp $ */
+/* $OpenBSD: rm.c,v 1.30 2015/01/16 06:39:32 deraadt Exp $ */
/* $NetBSD: rm.c,v 1.19 1995/09/07 06:48:50 jtc Exp $ */
/*-
@@ -32,7 +32,6 @@
#include <sys/types.h>
#include <sys/stat.h>
-#include <sys/param.h>
#include <sys/mount.h>
#include <locale.h>
@@ -44,9 +43,12 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#include <pwd.h>
#include <grp.h>
+#define MAXIMUM(a, b) (((a) > (b)) ? (a) : (b))
+
extern char *__progname;
int dflag, eval, fflag, iflag, Pflag, stdin_ok;
@@ -304,7 +306,7 @@ rm_overwrite(char *file, struct stat *sbp)
}
if (fstatfs(fd, &fsb) == -1)
goto err;
- bsize = MAX(fsb.f_iosize, 1024U);
+ bsize = MAXIMUM(fsb.f_iosize, 1024U);
if ((buf = malloc(bsize)) == NULL)
err(1, "%s: malloc", file);