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)
|
||||
{
|
||||
// TODO: POSIX says we should use O_CLOEXEC here. That seems quite hacky to
|
||||
// me. Is that stupid? If so, I'll leave it out.
|
||||
int fd = open(path, O_SEARCH | O_DIRECTORY);
|
||||
int fd = open(path, O_SEARCH | O_DIRECTORY | O_CLOEXEC);
|
||||
if ( fd < 0 ) { return NULL; }
|
||||
DIR* dir = fdopendir(fd);
|
||||
if ( !dir ) { close(fd); return NULL; }
|
||||
|
|
Loading…
Add table
Reference in a new issue