X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=KernelLand%2FKernel%2Fvfs%2Fio.c;h=24aa78baa44a7152169744319ca75e7f8de4b7dd;hb=27cb4fff4ed854d8be598a1157265c6de8aa035a;hp=1df3403460f3b96d23a4e70908a61c3c449b4b1f;hpb=802447e3e329c7519643f03094be9e18c62878ad;p=tpg%2Facess2.git diff --git a/KernelLand/Kernel/vfs/io.c b/KernelLand/Kernel/vfs/io.c index 1df34034..24aa78ba 100644 --- a/KernelLand/Kernel/vfs/io.c +++ b/KernelLand/Kernel/vfs/io.c @@ -41,7 +41,8 @@ size_t VFS_Read(int FD, size_t Length, void *Buffer) } if( !MM_GetPhysAddr(h->Node->Type->Read) ) { - Log_Error("VFS", "Node type %p(%s) read method is junk %p", h->Node->Type, h->Node, h->Node->Type->TypeName, + Log_Error("VFS", "Node type %p(%s) read method is junk %p", + h->Node->Type, h->Node, h->Node->Type->TypeName, h->Node->Type->Read); LEAVE_RET('i', -1); } @@ -98,10 +99,19 @@ size_t VFS_Write(int FD, size_t Length, const void *Buffer) h = VFS_GetHandle(FD); if(!h) return -1; - if( !(h->Mode & VFS_OPENFLAG_WRITE) ) return -1; - if( h->Node->Flags & VFS_FFLAG_DIRECTORY ) return -1; + if( !(h->Mode & VFS_OPENFLAG_WRITE) ) { + LOG("FD%i not opened for writing", FD); + return -1; + } + if( h->Node->Flags & VFS_FFLAG_DIRECTORY ) { + LOG("FD%i is a director", FD); + return -1; + } - if( !h->Node->Type || !h->Node->Type->Write ) return 0; + if( !h->Node->Type || !h->Node->Type->Write ) { + LOG("FD%i has no write method", FD); + return 0; + } if( !MM_GetPhysAddr(h->Node->Type->Write) ) { Log_Error("VFS", "Node type %p(%s) write method is junk %p", h->Node->Type, h->Node, h->Node->Type->TypeName,