From b7c4d38b320b8da0c9e318dbbdc2cc0ad966a93b Mon Sep 17 00:00:00 2001 From: Nebuleon Fumika Date: Mon, 20 Jun 2016 07:19:37 +0000 Subject: [PATCH] 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. --- source/fatdir.c | 1 - 1 file changed, 1 deletion(-) diff --git a/source/fatdir.c b/source/fatdir.c index 435d85b..1ff2677 100644 --- a/source/fatdir.c +++ b/source/fatdir.c @@ -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; }