mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Set O_CLOEXEC in opendir(3).
This commit is contained in:
parent
2c2fd29585
commit
5ebf7a3c88
1 changed files with 1 additions and 3 deletions
|
@ -131,9 +131,7 @@ DIR* fdopendir(int fd)
|
||||||
|
|
||||||
DIR* opendir(const char* path)
|
DIR* opendir(const char* path)
|
||||||
{
|
{
|
||||||
// TODO: POSIX says we should use O_CLOEXEC here. That seems quite hacky to
|
int fd = open(path, O_SEARCH | O_DIRECTORY | O_CLOEXEC);
|
||||||
// me. Is that stupid? If so, I'll leave it out.
|
|
||||||
int fd = open(path, O_SEARCH | O_DIRECTORY);
|
|
||||||
if ( fd < 0 ) { return NULL; }
|
if ( fd < 0 ) { return NULL; }
|
||||||
DIR* dir = fdopendir(fd);
|
DIR* dir = fdopendir(fd);
|
||||||
if ( !dir ) { close(fd); return NULL; }
|
if ( !dir ) { close(fd); return NULL; }
|
||||||
|
|
Loading…
Add table
Reference in a new issue