LibC: make opendir() fail if path is not a directory

This commit is contained in:
Bananymous 2024-08-01 22:57:46 +03:00
parent a578527012
commit 1d9041f2aa
1 changed files with 1 additions and 1 deletions

View File

@ -55,7 +55,7 @@ DIR* fdopendir(int fd)
DIR* opendir(const char* dirname) DIR* opendir(const char* dirname)
{ {
int fd = open(dirname, O_RDONLY); int fd = open(dirname, O_RDONLY | O_DIRECTORY);
if (fd == -1) if (fd == -1)
return nullptr; return nullptr;
return fdopendir(fd); return fdopendir(fd);