about summary refs log tree commit diff
path: root/dirent/tst-fdopendir2.c
diff options
context:
space:
mode:
authorAurelien Jarno <aurelien@aurel32.net>2017-12-29 14:44:57 +0100
committerAurelien Jarno <aurelien@aurel32.net>2017-12-29 14:45:35 +0100
commit72f29e3aab56cf9bd11d60ae351fbf9d5c709ada (patch)
tree82192c5a742b395c645a983f9fbbc7c188db7601 /dirent/tst-fdopendir2.c
parent54e4efc2876b329ba80a6965a2583a906d99e694 (diff)
downloadglibc-72f29e3aab56cf9bd11d60ae351fbf9d5c709ada.tar.gz
glibc-72f29e3aab56cf9bd11d60ae351fbf9d5c709ada.tar.xz
glibc-72f29e3aab56cf9bd11d60ae351fbf9d5c709ada.zip
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.
Diffstat (limited to 'dirent/tst-fdopendir2.c')
0 files changed, 0 insertions, 0 deletions