X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;ds=sidebyside;f=KernelLand%2FModules%2FFilesystems%2FExt2%2Fdir.c;h=2f2b72f67267070779a2f5ad0bb3f64fb29bbc69;hb=015f48988e0ff398409d71dfc692005ab439490a;hp=33df84721749233236ee431a89016468d6a11f73;hpb=04a050f42807686dc119838c82372409246d55bb;p=tpg%2Facess2.git diff --git a/KernelLand/Modules/Filesystems/Ext2/dir.c b/KernelLand/Modules/Filesystems/Ext2/dir.c index 33df8472..2f2b72f6 100644 --- a/KernelLand/Modules/Filesystems/Ext2/dir.c +++ b/KernelLand/Modules/Filesystems/Ext2/dir.c @@ -14,7 +14,7 @@ // === PROTOTYPES === int Ext2_ReadDir(tVFS_Node *Node, int Pos, char Dest[FILENAME_MAX]); -tVFS_Node *Ext2_FindDir(tVFS_Node *Node, const char *FileName); +tVFS_Node *Ext2_FindDir(tVFS_Node *Node, const char *FileName, Uint Flags); tVFS_Node *Ext2_MkNod(tVFS_Node *Node, const char *Name, Uint Flags); int Ext2_Unlink(tVFS_Node *Node, const char *OldName); int Ext2_Link(tVFS_Node *Parent, const char *Name, tVFS_Node *Node); @@ -124,7 +124,7 @@ int Ext2_ReadDir(tVFS_Node *Node, int Pos, char Dest[FILENAME_MAX]) * \param Filename Name of wanted file * \return VFS Node of file */ -tVFS_Node *Ext2_FindDir(tVFS_Node *Node, const char *Filename) +tVFS_Node *Ext2_FindDir(tVFS_Node *Node, const char *Filename, Uint Flags) { tExt2_Disk *disk = Node->ImplPtr; tExt2_Inode inode; @@ -147,10 +147,8 @@ tVFS_Node *Ext2_FindDir(tVFS_Node *Node, const char *Filename) while(size > 0) { VFS_ReadAt( disk->FD, Base+ofs, sizeof(tExt2_DirEnt), &dirent); - // TODO: Possible overrun if name_len == 255? - dirent.name[ dirent.name_len ] = '\0'; // Cap off string // If it matches, create a node and return it - if(dirent.name_len == filenameLen && strcmp(dirent.name, Filename) == 0) + if(dirent.name_len == filenameLen && strncmp(dirent.name, Filename, filenameLen) == 0) return Ext2_int_CreateNode( disk, dirent.inode ); // Increment pointers ofs += dirent.rec_len;