Kernel/VFS - Error catching in MkNod/O_CREAT
authorJohn Hodge <[email protected]>
Wed, 11 Jul 2012 15:37:12 +0000 (23:37 +0800)
committerJohn Hodge <[email protected]>
Wed, 11 Jul 2012 15:37:12 +0000 (23:37 +0800)
KernelLand/Kernel/include/vfs_ext.h
KernelLand/Kernel/vfs/dir.c
KernelLand/Kernel/vfs/open.c

index b4d5e2a..df68c4c 100644 (file)
@@ -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
 /**
index d4c1530..e2b124d 100644 (file)
@@ -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;
        }
index 2865f78..d55b754 100644 (file)
@@ -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);
        }
        

UCC git Repository :: git.ucc.asn.au