mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-01 10:43:32 +00:00
Fix a file descriptor leak in fts_child().
Obtained from: NetBSD
This commit is contained in:
parent
346e3178ea
commit
ce5c3df1b2
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=189348
@ -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…
Reference in New Issue
Block a user