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