Fixed not removing the flag from the string in VFS_ReadDir
authorJohn Hodge <[email protected]>
Sat, 26 Sep 2009 02:05:47 +0000 (10:05 +0800)
committerJohn Hodge <[email protected]>
Sat, 26 Sep 2009 02:05:47 +0000 (10:05 +0800)
Kernel/vfs/dir.c
Kernel/vfs/fs/fat.c

index 5702986..39cd3ec 100644 (file)
@@ -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;
index 87b5d87..88f8a09 100644 (file)
@@ -665,16 +665,16 @@ char *FAT_ReadDir(tVFS_Node *dirNode, int dirpos)
        // Offset in sector\r
        a = dirpos & 0xF;\r
 \r
-       LOG("offset=%i, a=%i\n", (Uint)offset, a);\r
+       LOG("offset=%i, a=%i", (Uint)offset, a);\r
        \r
        // Read Sector\r
        VFS_ReadAt(disk->fileHandle, offset*512, 512, fileinfo);        // Read Dir Data\r
        \r
-       LOG("name[0] = 0x%x\n", (Uint8)fileinfo[a].name[0]);\r
+       LOG("name[0] = 0x%x", (Uint8)fileinfo[a].name[0]);\r
        //Check if this is the last entry\r
        if(fileinfo[a].name[0] == '\0') {\r
                dirNode->Size = dirpos;\r
-               LOG("End of list\n");\r
+               LOG("End of list");\r
                LEAVE('n');\r
                return NULL;    // break\r
        }\r

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