LibC: make opendir() fail if path is not a directory
This commit is contained in:
parent
a578527012
commit
1d9041f2aa
|
@ -55,7 +55,7 @@ DIR* fdopendir(int fd)
|
|||
|
||||
DIR* opendir(const char* dirname)
|
||||
{
|
||||
int fd = open(dirname, O_RDONLY);
|
||||
int fd = open(dirname, O_RDONLY | O_DIRECTORY);
|
||||
if (fd == -1)
|
||||
return nullptr;
|
||||
return fdopendir(fd);
|
||||
|
|
Loading…
Reference in New Issue