From c91c6d4a2eb917fa6c3573dc8999fc0160115a61 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sat, 26 Sep 2009 10:05:47 +0800 Subject: [PATCH] Fixed not removing the flag from the string in VFS_ReadDir --- Kernel/vfs/dir.c | 8 +++++--- Kernel/vfs/fs/fat.c | 6 +++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Kernel/vfs/dir.c b/Kernel/vfs/dir.c index 5702986c..39cd3ecb 100644 --- a/Kernel/vfs/dir.c +++ b/Kernel/vfs/dir.c @@ -132,6 +132,7 @@ int VFS_Symlink(char *Name, char *Link) return 1; } +#define READDIR_FIXUP(ptr) (void*)( (Uint)(ptr) & ~1 ) /** * \fn int VFS_ReadDir(int FD, char *Dest) * \brief Read from a directory @@ -160,17 +161,18 @@ int VFS_ReadDir(int FD, char *Dest) else h->Position ++; } while(tmp != NULL && (Uint)tmp < (Uint)VFS_MAXSKIP); - LOG("tmp = '%s'", tmp); + + LOG("tmp = '%s'", READDIR_FIXUP(tmp)); if(!tmp) { LEAVE('i', 0); return 0; } - strcpy(Dest, tmp); + strcpy(Dest, READDIR_FIXUP(tmp)); if((Uint)tmp & 1) - free((void*)( (Uint)tmp & ~1 )); + free(READDIR_FIXUP(tmp)); LEAVE('i', 1); return 1; diff --git a/Kernel/vfs/fs/fat.c b/Kernel/vfs/fs/fat.c index 87b5d870..88f8a09d 100644 --- a/Kernel/vfs/fs/fat.c +++ b/Kernel/vfs/fs/fat.c @@ -665,16 +665,16 @@ char *FAT_ReadDir(tVFS_Node *dirNode, int dirpos) // Offset in sector a = dirpos & 0xF; - LOG("offset=%i, a=%i\n", (Uint)offset, a); + LOG("offset=%i, a=%i", (Uint)offset, a); // Read Sector VFS_ReadAt(disk->fileHandle, offset*512, 512, fileinfo); // Read Dir Data - LOG("name[0] = 0x%x\n", (Uint8)fileinfo[a].name[0]); + LOG("name[0] = 0x%x", (Uint8)fileinfo[a].name[0]); //Check if this is the last entry if(fileinfo[a].name[0] == '\0') { dirNode->Size = dirpos; - LOG("End of list\n"); + LOG("End of list"); LEAVE('n'); return NULL; // break } -- 2.20.1