mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-06 19:20:09 +00:00
Fix getdirentries in libc_ffat
This commit is contained in:
parent
bf91ea8926
commit
b86f0c8b32
@ -322,24 +322,20 @@ class Plugin : public Libc::Plugin
|
|||||||
FILINFO ffat_file_info;
|
FILINFO ffat_file_info;
|
||||||
FRESULT res;
|
FRESULT res;
|
||||||
|
|
||||||
const unsigned int index = *basep / sizeof(struct dirent);
|
res = f_readdir(_get_ffat_dir(fd), &ffat_file_info);
|
||||||
f_readdir(_get_ffat_dir(fd), 0);
|
switch(res) {
|
||||||
for (unsigned int i = 0; i <= index; i++) {
|
case FR_OK:
|
||||||
res = f_readdir(_get_ffat_dir(fd), &ffat_file_info);
|
break;
|
||||||
switch(res) {
|
case FR_DISK_ERR:
|
||||||
case FR_OK:
|
case FR_INT_ERR:
|
||||||
break;
|
case FR_NOT_READY:
|
||||||
case FR_DISK_ERR:
|
case FR_INVALID_OBJECT:
|
||||||
case FR_INT_ERR:
|
errno = EIO;
|
||||||
case FR_NOT_READY:
|
return -1;
|
||||||
case FR_INVALID_OBJECT:
|
default:
|
||||||
errno = EIO;
|
/* not supposed to occur according to the libffat documentation */
|
||||||
return -1;
|
PERR("f_readdir() returned an unexpected error code");
|
||||||
default:
|
return -1;
|
||||||
/* not supposed to occur according to the libffat documentation */
|
|
||||||
PERR("f_readdir() returned an unexpected error code");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ffat_file_info.fname[0] == 0) { /* no (more) entries */
|
if (ffat_file_info.fname[0] == 0) { /* no (more) entries */
|
||||||
@ -359,7 +355,7 @@ class Plugin : public Libc::Plugin
|
|||||||
dirent->d_reclen = sizeof(struct dirent);
|
dirent->d_reclen = sizeof(struct dirent);
|
||||||
|
|
||||||
::strncpy(dirent->d_name, ffat_file_info.fname,
|
::strncpy(dirent->d_name, ffat_file_info.fname,
|
||||||
sizeof(dirent->d_name));
|
sizeof(dirent->d_name));
|
||||||
|
|
||||||
dirent->d_namlen = ::strlen(dirent->d_name);
|
dirent->d_namlen = ::strlen(dirent->d_name);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user