git: libc: Do not set errno when mmap(MAP_TRYFIXED) fails.
Rimvydas Jasinskas
zrj at crater.dragonflybsd.org
Fri Apr 15 23:48:24 PDT 2016
commit e00a0047a7ca4a967f6623f6108883a3bdbce1a6
Author: zrj <rimvydas.jasinskas at gmail.com>
Date: Tue Apr 12 13:16:05 2016 +0300
libc: Do not set errno when mmap(MAP_TRYFIXED) fails.
If this mmap call fails, we'll fall back to moving the allocation to
a different virtual address. Setting errno here might result in
functions further up the call stack misinterpreting an error condition.
Indeed, this surfaced in git's calling of getdelim() in a loop, where
getdelim() would return -1 at EOF, but the caller would find ENOMEM in
errno from a previous, successful, call and interpret that as an OOM.
Fix-to: 07a8ffeaab3fc830679c6836a6ee198ad1a3275f
Suggested-by: aggelos
Summary of changes:
lib/libc/stdlib/nmalloc.c | 2 ++
1 file changed, 2 insertions(+)
http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/e00a0047a7ca4a967f6623f6108883a3bdbce1a6
--
DragonFly BSD source repository
More information about the Commits
mailing list