fixup! Fix bugs in glob(3).
This commit is contained in:
parent
e737851ae6
commit
4187705c9f
1 changed files with 3 additions and 2 deletions
|
@ -363,9 +363,10 @@ int glob(const char* restrict pattern,
|
|||
int subdirfd = openat(fd, name, mode | O_DIRECTORY | O_CLOEXEC);
|
||||
free(name);
|
||||
next_segment->dir = subdirfd < 0 ? NULL : fdopendir(subdirfd);
|
||||
if ( 0 <= subdirfd && !next_segment->dir )
|
||||
if ( !next_segment->dir )
|
||||
{
|
||||
close(subdirfd);
|
||||
if ( 0 <= subdirfd )
|
||||
close(subdirfd);
|
||||
if ( errno != ENOENT && errno != ENOTDIR &&
|
||||
((errfunc && errfunc(path, errno)) || (flags & GLOB_ERR)) )
|
||||
result = GLOB_ABORTED;
|
||||
|
|
Loading…
Reference in a new issue