From 6e536ba8f900b0f0d3cf8b4aa5a53b29e110c90d Mon Sep 17 00:00:00 2001 From: Jonas 'Sortie' Termansen Date: Sun, 11 Mar 2012 17:55:52 +0100 Subject: [PATCH] Fixed error codes in sortix/fs/devfs. --- sortix/fs/devfs.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sortix/fs/devfs.cpp b/sortix/fs/devfs.cpp index 72e27bf6..778c5ba2 100644 --- a/sortix/fs/devfs.cpp +++ b/sortix/fs/devfs.cpp @@ -285,11 +285,12 @@ namespace Sortix Device* DevDevFS::Open(const char* path, int flags, mode_t mode) { - if ( (flags & O_LOWERFLAGS) == O_SEARCH ) + int lowerflags = flags & O_LOWERFLAGS; + + if ( !path[0] || (path[0] == '/' && !path[1]) ) { - if ( path[0] == 0 || (path[0] == '/' && path[1] == 0) ) { return new DevDevFSDir(); } - Error::Set(ENOTDIR); - return NULL; + if ( lowerflags != O_SEARCH ) { Error::Set(EISDIR); return NULL; } + return new DevDevFSDir(); } if ( String::Compare(path, "/null") == 0 ) { return new DevNull; }