]> sourceware.org Git - glibc.git/commit
scandir: fix wrong assumption about errno [BZ #17804]
authorAurelien Jarno <aurelien@aurel32.net>
Fri, 29 Dec 2017 13:44:57 +0000 (14:44 +0100)
committerAurelien Jarno <aurelien@aurel32.net>
Fri, 29 Dec 2017 13:45:35 +0000 (14:45 +0100)
commit72f29e3aab56cf9bd11d60ae351fbf9d5c709ada
tree82192c5a742b395c645a983f9fbbc7c188db7601
parent54e4efc2876b329ba80a6965a2583a906d99e694
scandir: fix wrong assumption about errno [BZ #17804]

malloc and realloc may set errno to ENOMEM even if they are successful.
The scandir code wrongly assume that they do not change errno, this
causes scandir to fail with ENOMEM even if malloc succeed.

The code already handles that readdir might set errno by calling
__set_errno (0) to clear the error. Move that part at the end of the
loop to also take malloc and realloc into account.

Changelog:
[BZ #17804]
* dirent/scandir-tail.c (SCANDIR_TAIL): Move __set_errno (0) at the
end of the loop. Improve comments.
ChangeLog
dirent/scandir-tail.c
This page took 0.044143 seconds and 5 git commands to generate.