Fix a file descriptor leak in fts_child().
Obtained from: NetBSD
This commit is contained in:
parent
346e3178ea
commit
ce5c3df1b2
@ -570,8 +570,10 @@ fts_children(sp, instr)
|
||||
if ((fd = _open(".", O_RDONLY, 0)) < 0)
|
||||
return (NULL);
|
||||
sp->fts_child = fts_build(sp, instr);
|
||||
if (fchdir(fd))
|
||||
if (fchdir(fd)) {
|
||||
(void)_close(fd);
|
||||
return (NULL);
|
||||
}
|
||||
(void)_close(fd);
|
||||
return (sp->fts_child);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user