From: John Hodge Date: Wed, 11 Jul 2012 15:37:12 +0000 (+0800) Subject: Kernel/VFS - Error catching in MkNod/O_CREAT X-Git-Tag: rel0.15~611^2~41^2~20 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=0e280aab008d3b1dda0fd3e441291430fe188dbc;p=tpg%2Facess2.git Kernel/VFS - Error catching in MkNod/O_CREAT --- diff --git a/KernelLand/Kernel/include/vfs_ext.h b/KernelLand/Kernel/include/vfs_ext.h index b4d5e2ad..df68c4c5 100644 --- a/KernelLand/Kernel/include/vfs_ext.h +++ b/KernelLand/Kernel/include/vfs_ext.h @@ -29,6 +29,8 @@ typedef Uint32 tMount; #define VFS_OPENFLAG_NOLINK 0x40 //! Create the file if it doesn't exist #define VFS_OPENFLAG_CREATE 0x80 +//! Treat as a directory +#define VFS_OPENFLAG_DIRECTORY 0x100 //! Open as a user #define VFS_OPENFLAG_USER 0x8000 /** diff --git a/KernelLand/Kernel/vfs/dir.c b/KernelLand/Kernel/vfs/dir.c index d4c15309..e2b124dc 100644 --- a/KernelLand/Kernel/vfs/dir.c +++ b/KernelLand/Kernel/vfs/dir.c @@ -97,7 +97,7 @@ int VFS_MkNod(const char *Path, Uint Flags) _CloseNode(parent); // Error Check - if(ret == 0) { + if(ret != 0) { LEAVE('i', -1); return -1; } diff --git a/KernelLand/Kernel/vfs/open.c b/KernelLand/Kernel/vfs/open.c index 2865f781..d55b7546 100644 --- a/KernelLand/Kernel/vfs/open.c +++ b/KernelLand/Kernel/vfs/open.c @@ -485,7 +485,10 @@ int VFS_OpenEx(const char *Path, Uint Flags, Uint Mode) { // TODO: Translate `Mode` into ACL and node flags // Get parent, create node - VFS_MkNod(absPath, 0); + if( VFS_MkNod(absPath, 0) ) { + free(absPath); + return -1; + } node = VFS_ParsePath(absPath, NULL, &mnt); }