Skip to content

Commit

Permalink
glob: fix wrong return code when aborting before any matches
Browse files Browse the repository at this point in the history
when the result count was zero, glob was ignoring a possible
GLOB_ABORTED error code and returning GLOB_NOMATCH. whether this
happened could be nondeterministic and dependent on the order of
dirent enumeration, in cases where multiple matches were present and
only some produced errors.

caught by Tor's test_util_glob.
  • Loading branch information
richfelker committed Aug 24, 2023
1 parent 7291c6c commit 79bdacf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/regex/glob.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ int glob(const char *restrict pat, int flags, int (*errfunc)(const char *path, i
if (append(&tail, pat, strlen(pat), 0))
return GLOB_NOSPACE;
cnt++;
} else
} else if (!error)
return GLOB_NOMATCH;
}

Expand Down

0 comments on commit 79bdacf

Please sign in to comment.