summaryrefslogtreecommitdiffstats
path: root/usr.bin/file/apprentice.c
diff options
context:
space:
mode:
authordoug <doug@openbsd.org>2015-01-16 08:24:04 +0000
committerdoug <doug@openbsd.org>2015-01-16 08:24:04 +0000
commit24b22a50550128af6e6470ee4624ea7b1d51388b (patch)
treec752ab6e933811374ad13580490f22955a27e333 /usr.bin/file/apprentice.c
parentwhen hostname canonicalisation is enabled, try to parse hostnames (diff)
downloadwireguard-openbsd-24b22a50550128af6e6470ee4624ea7b1d51388b.tar.xz
wireguard-openbsd-24b22a50550128af6e6470ee4624ea7b1d51388b.zip
Replace <sys/param.h> with <limits.h>
This patch is from Theo. I helped verify that removing <sys/param.h> doesn't change anything. This produces the same binaries before and after with clang 3.5 and gcc 4.9.4 on amd64. There is a slight difference in the way it is generated by our old gcc 4.2.1 despite the fact that the preprocessed input is almost identical. ok deraadt@
Diffstat (limited to 'usr.bin/file/apprentice.c')
-rw-r--r--usr.bin/file/apprentice.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/usr.bin/file/apprentice.c b/usr.bin/file/apprentice.c
index e19382a19a8..1c6a49e96e6 100644
--- a/usr.bin/file/apprentice.c
+++ b/usr.bin/file/apprentice.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: apprentice.c,v 1.32 2014/10/26 04:10:26 brad Exp $ */
+/* $OpenBSD: apprentice.c,v 1.33 2015/01/16 08:24:04 doug Exp $ */
/*
* Copyright (c) Ian F. Darwin 1986-1995.
* Software written by Ian F. Darwin and others;
@@ -30,7 +30,7 @@
* apprentice - make one pass through /etc/magic, learning its secrets.
*/
-#include <sys/param.h>
+
#include <sys/stat.h>
#include <sys/types.h>
@@ -73,8 +73,8 @@
#define MAP_FILE 0
#endif
-#ifndef MAXPATHLEN
-#define MAXPATHLEN 1024
+#ifndef PATH_MAX
+#define PATH_MAX 1024
#endif
struct magic_entry {
@@ -620,7 +620,7 @@ apprentice_load(struct magic_set *ms, struct magic **magicp, uint32_t *nmagicp,
int errs = 0;
struct magic_entry *marray;
uint32_t marraycount, i, mentrycount = 0, starttest;
- char subfn[MAXPATHLEN];
+ char subfn[PATH_MAX];
struct stat st;
DIR *dir;
struct dirent *d;
@@ -2034,7 +2034,7 @@ mkdbname(const char *fn, char **buf, int strip)
}
(void)asprintf(buf, "%s%s", fn, ext);
- if (*buf && strlen(*buf) > MAXPATHLEN) {
+ if (*buf && strlen(*buf) > PATH_MAX) {
free(*buf);
*buf = NULL;
}