diff options
Diffstat (limited to 'lib/libc/gen/glob.c')
-rw-r--r-- | lib/libc/gen/glob.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/libc/gen/glob.c b/lib/libc/gen/glob.c index 04fad2b522572..620cb71f20bce 100644 --- a/lib/libc/gen/glob.c +++ b/lib/libc/gen/glob.c @@ -478,7 +478,7 @@ globtilde(const Char *pattern, Char *patbuf, size_t patbuf_len, glob_t *pglob) return (NULL); dc = wbuf; - for (b = patbuf; b < eb && *dc != EOS; *b++ = *dc++) + for (b = patbuf; b < eb && *dc != EOS; *b++ = *dc++ | M_PROTECT) continue; if (*dc != EOS) return (NULL); @@ -712,7 +712,8 @@ glob3(Char *pathbuf, Char *pathend, Char *pathend_last, *pathend = EOS; if ((dirp = g_opendir(pathbuf, pglob)) == NULL) { - /* TODO: don't call for ENOENT or ENOTDIR? */ + if (errno == ENOENT || errno == ENOTDIR) + return (0); if (pglob->gl_flags & GLOB_ERR) return (GLOB_ABORTED); if (pglob->gl_errfunc) { @@ -937,8 +938,10 @@ g_opendir(Char *str, glob_t *pglob) if (*str == EOS) strcpy(buf, "."); else { - if (g_Ctoc(str, buf, sizeof(buf))) + if (g_Ctoc(str, buf, sizeof(buf))) { + errno = ENAMETOOLONG; return (NULL); + } } if (pglob->gl_flags & GLOB_ALTDIRFUNC) |