*/
static void
expand_shellcmd_onedir(
- char_u *pat,
- size_t pathlen, // length of the path portion of pat.
+ char_u *pathed_pattern, // fully pathed pattern
+ size_t pathlen, // length of the path portion of pathed_pattern
+ // (0 if no path).
char_u ***matches,
int *numMatches,
int flags,
garray_T *gap)
{
// Expand matches in one directory of $PATH.
- if (expand_wildcards(1, &pat, numMatches, matches, flags) != OK)
+ if (expand_wildcards(1, &pathed_pattern, numMatches, matches, flags) != OK)
return;
if (ga_grow(gap, *numMatches) == FAIL)
seplen = !after_pathsep(s, e) ? STRLEN_LITERAL(PATHSEPSTR) : 0;
}
+ // Make sure that the pathed pattern (ie the path and pattern concatenated
+ // together) will fit inside the buffer. If not skip it and move on to the
+ // next path.
if (pathlen + seplen + patlen + 1 <= MAXPATHL)
{
if (pathlen > 0)