Don't set errno at the end of a directory if no error occurred

In _FAT_dirnext, which implements a function similar to readdir, don't
set errno to ENOENT, because reaching the end of a directory is not an
error. This conforms to POSIX readdir and is consistent with _FAT_read
not setting errno when reaching EOF.
This commit is contained in:
Nebuleon Fumika 2016-06-20 07:19:37 +00:00
parent 3fde6ce161
commit b7c4d38b32

View File

@ -588,7 +588,6 @@ int _FAT_dirnext_r (struct _reent *r, DIR_ITER *dirState, char *filename, struct
// Make sure there is another file to report on
if (! state->validEntry) {
_FAT_unlock(&state->partition->lock);
r->_errno = ENOENT;
return -1;
}