diff options
author | Andreas Schwab <schwab@suse.de> | 2001-05-09 16:36:11 +0000 |
---|---|---|
committer | Andreas Schwab <schwab@suse.de> | 2001-05-09 16:36:11 +0000 |
commit | a92544ca120238d4da72e27e5a10012f8bf75955 (patch) | |
tree | e173acace3f2d349c9e2d39a7d7c54b777fd24ef /sysdeps | |
parent | 4ceae9156653a844f2a478b15acc16b1ee7eee18 (diff) | |
download | glibc-a92544ca120238d4da72e27e5a10012f8bf75955.tar.gz glibc-a92544ca120238d4da72e27e5a10012f8bf75955.tar.xz glibc-a92544ca120238d4da72e27e5a10012f8bf75955.zip |
* sysdeps/unix/readdir.c: Make sure we don't modify errno when we reached EOF.
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/unix/readdir.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sysdeps/unix/readdir.c b/sysdeps/unix/readdir.c index 4cb66ba2e4..312660a0c4 100644 --- a/sysdeps/unix/readdir.c +++ b/sysdeps/unix/readdir.c @@ -39,6 +39,7 @@ DIRENT_TYPE * __READDIR (DIR *dirp) { DIRENT_TYPE *dp; + int saved_errno = errno; __libc_lock_lock (dirp->lock); @@ -63,6 +64,9 @@ __READDIR (DIR *dirp) bytes = __GETDENTS (dirp->fd, dirp->data, maxread); if (bytes <= 0) { + /* Don't modifiy errno when reaching EOF. */ + if (bytes == 0) + __set_errno (saved_errno); dp = NULL; break; } |