From 8678ad6444ea4a43e266b7969e6551e70f7695f0 Mon Sep 17 00:00:00 2001 From: Jonas 'Sortie' Termansen Date: Tue, 22 Nov 2011 15:33:47 +0100 Subject: [PATCH] / is no longer a valid filename under ramfs. --- sortix/fs/ramfs.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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; }