summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--openbsd-compat/glob.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/openbsd-compat/glob.c b/openbsd-compat/glob.c
index 2166a71a2..9e7ff9e76 100644
--- a/openbsd-compat/glob.c
+++ b/openbsd-compat/glob.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: glob.c,v 1.39 2012/01/20 07:09:42 tedu Exp $ */ 1/* $OpenBSD: glob.c,v 1.40 2013/09/30 12:02:34 millert Exp $ */
2/* 2/*
3 * Copyright (c) 1989, 1993 3 * Copyright (c) 1989, 1993
4 * The Regents of the University of California. All rights reserved. 4 * The Regents of the University of California. All rights reserved.
@@ -180,7 +180,7 @@ glob(const char *pattern, int flags, int (*errfunc)(const char *, int),
180{ 180{
181 const u_char *patnext; 181 const u_char *patnext;
182 int c; 182 int c;
183 Char *bufnext, *bufend, patbuf[MAXPATHLEN]; 183 Char *bufnext, *bufend, patbuf[PATH_MAX];
184 struct glob_lim limit = { 0, 0, 0 }; 184 struct glob_lim limit = { 0, 0, 0 };
185 185
186 if (strnlen(pattern, PATH_MAX) == PATH_MAX) 186 if (strnlen(pattern, PATH_MAX) == PATH_MAX)
@@ -204,7 +204,7 @@ glob(const char *pattern, int flags, int (*errfunc)(const char *, int),
204 return GLOB_NOSPACE; 204 return GLOB_NOSPACE;
205 205
206 bufnext = patbuf; 206 bufnext = patbuf;
207 bufend = bufnext + MAXPATHLEN - 1; 207 bufend = bufnext + PATH_MAX - 1;
208 if (flags & GLOB_NOESCAPE) 208 if (flags & GLOB_NOESCAPE)
209 while (bufnext < bufend && (c = *patnext++) != EOS) 209 while (bufnext < bufend && (c = *patnext++) != EOS)
210 *bufnext++ = c; 210 *bufnext++ = c;
@@ -261,7 +261,7 @@ globexp2(const Char *ptr, const Char *pattern, glob_t *pglob,
261 int i, rv; 261 int i, rv;
262 Char *lm, *ls; 262 Char *lm, *ls;
263 const Char *pe, *pm, *pl; 263 const Char *pe, *pm, *pl;
264 Char patbuf[MAXPATHLEN]; 264 Char patbuf[PATH_MAX];
265 265
266 /* copy part up to the brace */ 266 /* copy part up to the brace */
267 for (lm = patbuf, pm = pattern; pm != ptr; *lm++ = *pm++) 267 for (lm = patbuf, pm = pattern; pm != ptr; *lm++ = *pm++)
@@ -473,9 +473,9 @@ glob0(const Char *pattern, glob_t *pglob, struct glob_lim *limitp)
473{ 473{
474 const Char *qpatnext; 474 const Char *qpatnext;
475 int c, err, oldpathc; 475 int c, err, oldpathc;
476 Char *bufnext, patbuf[MAXPATHLEN]; 476 Char *bufnext, patbuf[PATH_MAX];
477 477
478 qpatnext = globtilde(pattern, patbuf, MAXPATHLEN, pglob); 478 qpatnext = globtilde(pattern, patbuf, PATH_MAX, pglob);
479 oldpathc = pglob->gl_pathc; 479 oldpathc = pglob->gl_pathc;
480 bufnext = patbuf; 480 bufnext = patbuf;
481 481
@@ -545,7 +545,7 @@ glob0(const Char *pattern, glob_t *pglob, struct glob_lim *limitp)
545 qprintf("glob0:", patbuf); 545 qprintf("glob0:", patbuf);
546#endif 546#endif
547 547
548 if ((err = glob1(patbuf, patbuf+MAXPATHLEN-1, pglob, limitp)) != 0) 548 if ((err = glob1(patbuf, patbuf+PATH_MAX-1, pglob, limitp)) != 0)
549 return(err); 549 return(err);
550 550
551 /* 551 /*
@@ -609,13 +609,13 @@ compare_gps(const void *_p, const void *_q)
609static int 609static int
610glob1(Char *pattern, Char *pattern_last, glob_t *pglob, struct glob_lim *limitp) 610glob1(Char *pattern, Char *pattern_last, glob_t *pglob, struct glob_lim *limitp)
611{ 611{
612 Char pathbuf[MAXPATHLEN]; 612 Char pathbuf[PATH_MAX];
613 613
614 /* A null pathname is invalid -- POSIX 1003.1 sect. 2.4. */ 614 /* A null pathname is invalid -- POSIX 1003.1 sect. 2.4. */
615 if (*pattern == EOS) 615 if (*pattern == EOS)
616 return(0); 616 return(0);
617 return(glob2(pathbuf, pathbuf+MAXPATHLEN-1, 617 return(glob2(pathbuf, pathbuf+PATH_MAX-1,
618 pathbuf, pathbuf+MAXPATHLEN-1, 618 pathbuf, pathbuf+PATH_MAX-1,
619 pattern, pattern_last, pglob, limitp)); 619 pattern, pattern_last, pglob, limitp));
620} 620}
621 621
@@ -700,7 +700,7 @@ glob3(Char *pathbuf, Char *pathbuf_last, Char *pathend, Char *pathend_last,
700 struct dirent *dp; 700 struct dirent *dp;
701 DIR *dirp; 701 DIR *dirp;
702 int err; 702 int err;
703 char buf[MAXPATHLEN]; 703 char buf[PATH_MAX];
704 704
705 /* 705 /*
706 * The readdirfunc declaration can't be prototyped, because it is 706 * The readdirfunc declaration can't be prototyped, because it is
@@ -983,7 +983,7 @@ globfree(glob_t *pglob)
983static DIR * 983static DIR *
984g_opendir(Char *str, glob_t *pglob) 984g_opendir(Char *str, glob_t *pglob)
985{ 985{
986 char buf[MAXPATHLEN]; 986 char buf[PATH_MAX];
987 987
988 if (!*str) 988 if (!*str)
989 strlcpy(buf, ".", sizeof buf); 989 strlcpy(buf, ".", sizeof buf);
@@ -1001,7 +1001,7 @@ g_opendir(Char *str, glob_t *pglob)
1001static int 1001static int
1002g_lstat(Char *fn, struct stat *sb, glob_t *pglob) 1002g_lstat(Char *fn, struct stat *sb, glob_t *pglob)
1003{ 1003{
1004 char buf[MAXPATHLEN]; 1004 char buf[PATH_MAX];
1005 1005
1006 if (g_Ctoc(fn, buf, sizeof(buf))) 1006 if (g_Ctoc(fn, buf, sizeof(buf)))
1007 return(-1); 1007 return(-1);
@@ -1013,7 +1013,7 @@ g_lstat(Char *fn, struct stat *sb, glob_t *pglob)
1013static int 1013static int
1014g_stat(Char *fn, struct stat *sb, glob_t *pglob) 1014g_stat(Char *fn, struct stat *sb, glob_t *pglob)
1015{ 1015{
1016 char buf[MAXPATHLEN]; 1016 char buf[PATH_MAX];
1017 1017
1018 if (g_Ctoc(fn, buf, sizeof(buf))) 1018 if (g_Ctoc(fn, buf, sizeof(buf)))
1019 return(-1); 1019 return(-1);