General cleanup and bugfixes
[tpg/acess2.git] / KernelLand / Kernel / vfs / open.c
index e7d6e1e..344b2a1 100644 (file)
@@ -201,6 +201,7 @@ restart_parse:
                        *TruePath = malloc( gVFS_RootMount->MountPointLen+1 );
                        strcpy(*TruePath, gVFS_RootMount->MountPoint);
                }
+               gVFS_RootMount->OpenHandleCount ++;
                if(MountPoint)  *MountPoint = gVFS_RootMount;
                LEAVE('p', gVFS_RootMount->RootNode);
                return gVFS_RootMount->RootNode;
@@ -282,9 +283,16 @@ restart_parse:
                }
                
                // Check if the node has a FindDir method
+               if( !curNode->Type )
+               {
+                       LOG("Finddir failure on '%s' - No type", Path);
+                       Log_Error("VFS", "Node at '%s' has no type (mount %s:%s)",
+                               Path, mnt->Filesystem->Name, mnt->MountPoint);
+                       goto _error;
+               }
                if( !curNode->Type->FindDir )
                {
-                       LOG("Finddir failure on '%s'", Path);
+                       LOG("Finddir failure on '%s' - No FindDir method in %s", Path, curNode->Type->Name);
                        goto _error;
                }
                LOG("FindDir{=%p}(%p, '%s')", curNode->Type->FindDir, curNode, pathEle);
@@ -646,7 +654,8 @@ void VFS_Close(int FD)
        
        _CloseNode(h->Node);
 
-       h->Mount->OpenHandleCount --;   
+       if( h->Mount )
+               h->Mount->OpenHandleCount --;   
 
        h->Node = NULL;
 }

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