HomeFreeBSD

1) Per POSIX (and glibc) GLOB_NOCHECK should return original pattern,

Description

  1. Per POSIX (and glibc) GLOB_NOCHECK should return original pattern,

unmodified, if no matches found. But our original code strips all '\'
returning it. Rewrite the code to allow to reconstruct exact the
original pattern with backslashes for this case.

  1. Prevent to use truncated pattern if MAXPATHLEN exceeded, return

GLOB_NOMATCH instead.

  1. Fix few end loop conditions filling Char arrays with mbrtowc(),

MB_CUR_MAX is unneeded in two places and condition is less by one
in other place.

  1. Prevent to use truncated filenames match if MAXPATHLEN exceeded,

skip such directory entries.

  1. Don't end *pathend with L'/' in glob3() if limit is reached, this

change will be not visible since error is returned.

  1. If error happens in (*readdirfunc)(), do the same GLOB_ABORTED

processing as for g_opendir() as POSIX requires.

Details

Provenance
acheAuthored on
Parents
rS303073: Fix a bug in deferred stream reset processing which results
Branches
Unknown
Tags
Unknown