* FAT's fs_read_dir() function filled the dirent::d_reclen member incorrectly,
causing a partial copy of the entry in vfs.cpp fix_dirent(), which then returned an error, making FAT directories unreadable. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27130 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
6a8cce077f
commit
c3eeae18ec
|
@ -1215,9 +1215,9 @@ dosfs_readdir(fs_volume *_vol, fs_vnode *_dir, void *_cookie,
|
||||||
|
|
||||||
LOCK_VOL(vol);
|
LOCK_VOL(vol);
|
||||||
|
|
||||||
if (check_nspace_magic(vol, "dosfs_readdir") ||
|
if (check_nspace_magic(vol, "dosfs_readdir")
|
||||||
check_vnode_magic(dir, "dosfs_readdir") ||
|
|| check_vnode_magic(dir, "dosfs_readdir")
|
||||||
check_dircookie_magic(cookie, "dosfs_readdir")) {
|
|| check_dircookie_magic(cookie, "dosfs_readdir")) {
|
||||||
UNLOCK_VOL(vol);
|
UNLOCK_VOL(vol);
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
|
@ -1232,10 +1232,10 @@ dosfs_readdir(fs_volume *_vol, fs_vnode *_dir, void *_cookie,
|
||||||
} else {
|
} else {
|
||||||
if (cookie->current_index++ == 0) {
|
if (cookie->current_index++ == 0) {
|
||||||
strcpy(entry->d_name, ".");
|
strcpy(entry->d_name, ".");
|
||||||
entry->d_reclen = 2;
|
entry->d_reclen = sizeof(struct dirent) + 1;
|
||||||
} else {
|
} else {
|
||||||
strcpy(entry->d_name, "..");
|
strcpy(entry->d_name, "..");
|
||||||
entry->d_reclen = 3;
|
entry->d_reclen = sizeof(struct dirent) + 2;
|
||||||
}
|
}
|
||||||
*num = 1;
|
*num = 1;
|
||||||
entry->d_ino = vol->root_vnode.vnid;
|
entry->d_ino = vol->root_vnode.vnid;
|
||||||
|
@ -1253,8 +1253,10 @@ dosfs_readdir(fs_volume *_vol, fs_vnode *_dir, void *_cookie,
|
||||||
result = B_NO_ERROR;
|
result = B_NO_ERROR;
|
||||||
goto bi;
|
goto bi;
|
||||||
}
|
}
|
||||||
result = get_next_dirent(vol, dir, &diri, &(entry->d_ino), entry->d_name,
|
|
||||||
|
result = get_next_dirent(vol, dir, &diri, &entry->d_ino, entry->d_name,
|
||||||
bufsize - sizeof(struct dirent) - 1);
|
bufsize - sizeof(struct dirent) - 1);
|
||||||
|
|
||||||
cookie->current_index = diri.current_index;
|
cookie->current_index = diri.current_index;
|
||||||
diri_free(&diri);
|
diri_free(&diri);
|
||||||
|
|
||||||
|
@ -1264,7 +1266,7 @@ dosfs_readdir(fs_volume *_vol, fs_vnode *_dir, void *_cookie,
|
||||||
if (result == B_NO_ERROR) {
|
if (result == B_NO_ERROR) {
|
||||||
*num = 1;
|
*num = 1;
|
||||||
entry->d_dev = vol->id;
|
entry->d_dev = vol->id;
|
||||||
entry->d_reclen = strlen(entry->d_name) + 1;
|
entry->d_reclen = sizeof(struct dirent) + strlen(entry->d_name);
|
||||||
DPRINTF(0, ("dosfs_readdir: found file %s\n", entry->d_name));
|
DPRINTF(0, ("dosfs_readdir: found file %s\n", entry->d_name));
|
||||||
} else if (result == ENOENT) {
|
} else if (result == ENOENT) {
|
||||||
// When you get to the end, don't return an error, just return 0
|
// When you get to the end, don't return an error, just return 0
|
||||||
|
|
Loading…
Reference in New Issue