Backport the following commit to fix upstream bug 25976: 790b8dda4455865cb8c3a47801f4304c1a43baf6 nss_compat: internal_end*ent may clobber errno, hiding ERANGE [BZ #25976] This also improves failure modes involving the SSSD NSS plugin, see: https://bugzilla.redhat.com/show_bug.cgi?id=1402403 Also we don't want to regress the fix in RHEL 7.9: https://bugzilla.redhat.com/show_bug.cgi?id=1834816