AcessNative - Better error reporting in NativeFS
authorJohn Hodge (sonata) <[email protected]>
Mon, 13 May 2013 07:49:54 +0000 (15:49 +0800)
committerJohn Hodge (sonata) <[email protected]>
Mon, 13 May 2013 07:49:54 +0000 (15:49 +0800)
AcessNative/acesskernel_src/nativefs.c

index 1781621..65e874d 100644 (file)
@@ -154,11 +154,18 @@ tVFS_Node *NativeFS_FindDir(tVFS_Node *Node, const char *Name)
        else\r
        {\r
                LOG("File");\r
-               baseRet.Inode = (Uint64)(tVAddr) fopen(path, "r+");\r
+               FILE    *fp = fopen(path, "r+");\r
+               if( !fp ) {\r
+                       Log_Error("NativeFS", "fopen of '%s' failed: %s", path, strerror(errno));\r
+                       free(path);\r
+                       LEAVE('n');\r
+                       return NULL;\r
+               }\r
+               baseRet.Inode = (Uint64)(tVAddr) fp;\r
                baseRet.Type = &gNativeFS_FileNodeType;\r
                \r
-               fseek( (FILE*)(tVAddr)baseRet.Inode, 0, SEEK_END );\r
-               baseRet.Size = ftell( (FILE*)(tVAddr)baseRet.Inode );\r
+               fseek( fp, 0, SEEK_END );\r
+               baseRet.Size = ftell( fp );\r
        }\r
        \r
        // Create new node\r

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