]> git.ipfire.org Git - thirdparty/systemd.git/commit
nss-resolve: report ERANGE for small buffers. (#5359)
authorMaarten de Vries <maarten@de-vri.es>
Thu, 16 Feb 2017 09:52:04 +0000 (10:52 +0100)
committerLennart Poettering <lennart@poettering.net>
Thu, 16 Feb 2017 09:52:04 +0000 (10:52 +0100)
commite36c6e48fbfe785629c515c070d90fb63c8ca4de
tree97d36752ff875561050f566444eb5229e715a6b2
parent28b1a3eac252d471de4fbb6f317353af30d68878
nss-resolve: report ERANGE for small buffers. (#5359)

The correct error code to report when a provided buffer is too small is
ERANGE. This is recognized by glibc, which will then try again with a
larger buffer. The old behaviour of reporting ENOMEM has no special
meaning for glibc. The error will simply be propagated to the
application, and a later retry will trigger the same error again.

Additionally, h_errnop must be set to NETDB_INTERNAL to have glibc look
at errnop for details.

More information at:
https://www.gnu.org/software/libc/manual/html_node/NSS-Modules-Interface.html
src/nss-resolve/nss-resolve.c