From e64acc0133b6ddd55b36a813aa338240a92be5b0 Mon Sep 17 00:00:00 2001 From: Dave Murphy Date: Thu, 25 Jan 2007 18:01:02 +0000 Subject: [PATCH] make dirnext return 0 for success & -1 for error/no more files --- source/fatdir.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/fatdir.c b/source/fatdir.c index 57ab2fa..2a24ef4 100644 --- a/source/fatdir.c +++ b/source/fatdir.c @@ -508,7 +508,8 @@ 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) { - return 0; + r->_errno = ENOENT; + return -1; } // Get the filename @@ -522,7 +523,7 @@ int _FAT_dirnext_r (struct _reent *r, DIR_ITER *dirState, char *filename, struct state->validEntry = _FAT_directory_getNextEntry (state->partition, &(state->currentEntry)); - return 1; + return 0; } int _FAT_dirclose_r (struct _reent *r, DIR_ITER *dirState) {