diff --git a/sortix/fs/ramfs.cpp b/sortix/fs/ramfs.cpp index 1db20c1f..4251d2c8 100644 --- a/sortix/fs/ramfs.cpp +++ b/sortix/fs/ramfs.cpp @@ -239,10 +239,14 @@ namespace Sortix Device* DevRAMFS::Open(const char* path, int flags, mode_t mode) { - if ( (flags & O_LOWERFLAGS) == O_SEARCH ) + if ( path[0] == 0 || (path[0] == '/' && path[1] == 0) ) { - if ( path[0] == 0 || (path[0] == '/' && path[1] == 0) ) { return new DevRAMFSDir(this); } - Error::Set(Error::ENOTDIR); + if ( (flags & O_LOWERFLAGS) == O_SEARCH ) + { + return new DevRAMFSDir(this); + } + + Error::Set(Error::EISDIR); return NULL; }