Fixed not removing the flag from the string in VFS_ReadDir
[tpg/acess2.git] / Kernel / vfs / dir.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;

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