diff --git a/newlib/ChangeLog b/newlib/ChangeLog index e16fe1273..a6292f4bf 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,8 @@ +2012-03-02 Jeff Johnston + + * libc/posix/readdir_r.c: Fix return code when end of + directory is reached. + 2012-02-23 Dan Egnor * configure.host: Accept "arm*" host spec instead of just "arm". diff --git a/newlib/libc/posix/readdir_r.c b/newlib/libc/posix/readdir_r.c index 9bc013c64..b9a0b9024 100644 --- a/newlib/libc/posix/readdir_r.c +++ b/newlib/libc/posix/readdir_r.c @@ -76,7 +76,7 @@ struct dirent *tmpdp; __lock_release_recursive(dirp->dd_lock); #endif *dpp = NULL; - return errno; + return dirp->dd_size == 0 ? 0 : errno; } } if (dirp->dd_loc >= dirp->dd_size) {