When we run out of buffer space and set result to NSS_STATUS_TRYAGAIN and errno to ERANGE, and we're also setting h_errno, set it to NETDB_INTERNAL, which libc also checks when it's available. The _nss_ldap_getbyname function will already have set errno for us, so we go with the patch as used rather than the original one, which also set errno here. diff -uNr nss_ldap-263/util.h nss_ldap-264/util.h --- nss_ldap-263/util.h 2008-10-15 09:30:45.000000000 -0400 +++ nss_ldap-264/util.h 2008-10-30 16:50:15.000000000 -0400 @@ -152,7 +152,7 @@ (herr) = 0; \ break; \ case NSS_TRYAGAIN: \ - (herr) = TRY_AGAIN; \ + (herr) = NETDB_INTERNAL;\ break; \ case NSS_NOTFOUND: \ (herr) = HOST_NOT_FOUND;\