summaryrefslogtreecommitdiffstats
path: root/usr.bin/find/function.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/find/function.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/find/function.c')
-rw-r--r--usr.bin/find/function.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/usr.bin/find/function.c b/usr.bin/find/function.c
index cb9542ecff8..be4e013393f 100644
--- a/usr.bin/find/function.c
+++ b/usr.bin/find/function.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: function.c,v 1.41 2014/05/18 08:10:00 espie Exp $ */
+/* $OpenBSD: function.c,v 1.42 2015/01/16 06:40:07 deraadt Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -32,8 +32,6 @@
* SUCH DAMAGE.
*/
-#include <sys/param.h>
-#include <sys/ucred.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <sys/mount.h>
@@ -575,8 +573,8 @@ c_exec(char *unused, char ***argvp, int isok)
for (p = *argv; *p; ++p)
if (p[0] == '{' && p[1] == '}') {
new->e_argv[cnt] =
- emalloc((u_int)MAXPATHLEN);
- new->e_len[cnt] = MAXPATHLEN;
+ emalloc((u_int)PATH_MAX);
+ new->e_len[cnt] = PATH_MAX;
break;
}
if (!*p) {
@@ -607,7 +605,7 @@ f_execdir(PLAN *plan, FTSENT *entry)
int cnt;
pid_t pid;
int status, fd;
- char base[MAXPATHLEN];
+ char base[PATH_MAX];
/* fts(3) does not chdir for the root level so we do it ourselves. */
if (entry->fts_level == FTS_ROOTLEVEL) {
@@ -693,8 +691,8 @@ c_execdir(char *ignored, char ***argvp, int unused)
new->e_orig[cnt] = *argv;
for (p = *argv; *p; ++p)
if (p[0] == '{' && p[1] == '}') {
- new->e_argv[cnt] = emalloc((u_int)MAXPATHLEN);
- new->e_len[cnt] = MAXPATHLEN;
+ new->e_argv[cnt] = emalloc((u_int)PATH_MAX);
+ new->e_len[cnt] = PATH_MAX;
break;
}
if (!*p) {