summaryrefslogtreecommitdiffstats
path: root/usr.bin/compress/zopen.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 /usr.bin/compress/zopen.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 'usr.bin/compress/zopen.c')
-rw-r--r--usr.bin/compress/zopen.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.bin/compress/zopen.c b/usr.bin/compress/zopen.c
index 12de049e712..919cc77eb0c 100644
--- a/usr.bin/compress/zopen.c
+++ b/usr.bin/compress/zopen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: zopen.c,v 1.18 2011/09/22 10:41:04 deraadt Exp $ */
+/* $OpenBSD: zopen.c,v 1.19 2015/01/16 06:40:06 deraadt Exp $ */
/* $NetBSD: zopen.c,v 1.5 1995/03/26 09:44:53 glass Exp $ */
/*-
@@ -58,7 +58,6 @@
* Any file produced by compress(1) can be read.
*/
-#include <sys/param.h>
#include <sys/stat.h>
#include <ctype.h>
@@ -71,6 +70,8 @@
#include <fcntl.h>
#include "compress.h"
+#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
+
#define BITS 16 /* Default bits. */
#define HSIZE 69001 /* 95% occupancy */
#define ZBUFSIZ 8192 /* I/O buffer size */
@@ -636,7 +637,7 @@ getcode(struct s_zstate *zs)
zs->zs_ebp = bp + bits;
}
zs->zs_offset = 0;
- zs->zs_size = MIN(zs->zs_n_bits, zs->zs_ebp - zs->zs_bp);
+ zs->zs_size = MINIMUM(zs->zs_n_bits, zs->zs_ebp - zs->zs_bp);
if (zs->zs_size == 0)
return -1;
/* Round size down to integral number of codes. */