From 708643d0f276358f71ca5b5810a950d0cef946a0 Mon Sep 17 00:00:00 2001 From: Jonas 'Sortie' Termansen Date: Thu, 17 Nov 2011 23:03:14 +0100 Subject: [PATCH] Fixed bug in dup(2). --- sortix/filesystem.cpp | 80 ------------------------------------------- sortix/io.cpp | 1 - 2 files changed, 81 deletions(-) delete mode 100644 sortix/filesystem.cpp diff --git a/sortix/filesystem.cpp b/sortix/filesystem.cpp deleted file mode 100644 index d19ab7dd..00000000 --- a/sortix/filesystem.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/****************************************************************************** - - COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011. - - This file is part of Sortix. - - Sortix is free software: you can redistribute it and/or modify it under the - terms of the GNU General Public License as published by the Free Software - Foundation, either version 3 of the License, or (at your option) any later - version. - - Sortix is distributed in the hope that it will be useful, but WITHOUT ANY - WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - details. - - You should have received a copy of the GNU General Public License along - with Sortix. If not, see . - - filesystem.cpp - Abstracts away a file system device. - -******************************************************************************/ - -#include "device.h" -#include "thread.h" -#include "process.h" -#include "filesystem.h" - -namespace Sortix -{ - bool DevFileSystem::LegalNodeName(const char* name) - { - if ( *name == '\0' ) { return false; } - while ( *name != '\0' ) - { - if ( *name == '/' ) { return false; } - } - return true; - } - - bool DevFileSystem::Open(const char* path, nat openFlags, nat mode, Mount::SysCallback* callbackInfo, Thread* thread) - { -#if 0 - nat requestMode = flags & O_LOWERFLAGS; - - MXFSNode* node; - - if ( flags & O_CREAT ) - { - if ( flags & O_DIRECTORY ) { return CreateDirectory(path, flags, permissions, type); } - else { return CreateFile(path, flags, permissions, type); } - } - else - { - node = Search(path); - } - - if ( node == NULL ) { return NULL; } - - if ( node->IsDir() ) - { - if ( requestMode == O_SEARCH || requestMode == O_RDONLY ) - { - // TODO: Make a directory device. - Error::Set(Error::NOTIMPLEMENTED); - return NULL; - } - else - { - Error::Set(Error::ISDIR); - return NULL; - } - } - - if ( -#endif - } -} - diff --git a/sortix/io.cpp b/sortix/io.cpp index e98df387..e1c838c6 100644 --- a/sortix/io.cpp +++ b/sortix/io.cpp @@ -131,7 +131,6 @@ namespace Sortix Process* process = CurrentProcess(); Device* dev = process->descriptors.Get(fd); if ( !dev ) { return -1; /* TODO: EBADF */ } - process->descriptors.Free(fd); return process->descriptors.Allocate(dev); }