diff options
| author | 2015-01-16 06:39:28 +0000 | |
|---|---|---|
| committer | 2015-01-16 06:39:28 +0000 | |
| commit | b9fc9a728fce9c4289b7e9a992665e28d5629a54 (patch) | |
| tree | 72b2433e418dfa1aef5fcf8305617b97979a25d8 /bin/csh/glob.c | |
| parent | improve checksum parsing slightly. now handles filenames with spaces. (diff) | |
| download | wireguard-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/csh/glob.c')
| -rw-r--r-- | bin/csh/glob.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/bin/csh/glob.c b/bin/csh/glob.c index 75605e57e64..d5d4a54c292 100644 --- a/bin/csh/glob.c +++ b/bin/csh/glob.c @@ -1,4 +1,4 @@ -/* $OpenBSD: glob.c,v 1.14 2014/10/16 19:43:31 deraadt Exp $ */ +/* $OpenBSD: glob.c,v 1.15 2015/01/16 06:39:31 deraadt Exp $ */ /* $NetBSD: glob.c,v 1.10 1995/03/21 09:03:01 cgd Exp $ */ /*- @@ -30,12 +30,13 @@ * SUCH DAMAGE. */ -#include <sys/param.h> +#include <sys/types.h> #include <glob.h> #include <errno.h> #include <stdlib.h> #include <string.h> #include <unistd.h> +#include <limits.h> #include <stdarg.h> #include "csh.h" @@ -87,12 +88,12 @@ static void backeval(Char *, bool); static Char * globtilde(Char **nv, Char *s) { - Char gbuf[MAXPATHLEN], *gstart, *b, *u, *e; + Char gbuf[PATH_MAX], *gstart, *b, *u, *e; gstart = gbuf; *gstart++ = *s++; u = s; - for (b = gstart, e = &gbuf[MAXPATHLEN - 1]; + for (b = gstart, e = &gbuf[PATH_MAX - 1]; *s && *s != '/' && *s != ':' && b < e; *b++ = *s++) continue; @@ -119,7 +120,7 @@ globbrace(Char *s, Char *p, Char ***bl) int i, len; Char *pm, *pe, *lm, *pl; Char **nv, **vl; - Char gbuf[MAXPATHLEN]; + Char gbuf[PATH_MAX]; int size = GLOBSPACE; nv = vl = xreallocarray(NULL, size, sizeof(Char *)); @@ -182,7 +183,7 @@ globbrace(Char *s, Char *p, Char ***bl) *pm = EOS; (void) Strlcpy(lm, pl, &gbuf[sizeof(gbuf)/sizeof(Char)] - lm); - (void) Strlcat(gbuf, pe + 1, MAXPATHLEN); + (void) Strlcat(gbuf, pe + 1, PATH_MAX); *pm = savec; *vl++ = Strsave(gbuf); len++; @@ -575,7 +576,7 @@ Char ** dobackp(Char *cp, bool literal) { Char *lp, *rp; - Char *ep, word[MAXPATHLEN]; + Char *ep, word[PATH_MAX]; if (pargv) { #ifdef notdef @@ -588,7 +589,7 @@ dobackp(Char *cp, bool literal) pargv[0] = NULL; pargcp = pargs = word; pargc = 0; - pnleft = MAXPATHLEN - 4; + pnleft = PATH_MAX - 4; for (;;) { for (lp = cp; *lp != '`'; lp++) { if (*lp == 0) { @@ -769,7 +770,7 @@ pword(void) pargv[pargc++] = Strsave(pargs); pargv[pargc] = NULL; pargcp = pargs; - pnleft = MAXPATHLEN - 4; + pnleft = PATH_MAX - 4; } int |
