From: Niko <2089413+NikoDelarich@users.noreply.github.com> Date: Tue, 1 Mar 2022 13:43:07 +0000 (+0100) Subject: Handle ERANGE error correctly X-Git-Tag: 4.12~52 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e9bf727253e13968c4c61d71f4725e668cd49881;p=thirdparty%2Fshadow.git Handle ERANGE error correctly The reentrant functions getgrgid_r, getgrnam_r, getpwnam_r, etc. all return an error code instead of setting errno. Adapt the error check accordingly. --- diff --git a/libmisc/xgetXXbyYY.c b/libmisc/xgetXXbyYY.c index db0102240..6a3f9693f 100644 --- a/libmisc/xgetXXbyYY.c +++ b/libmisc/xgetXXbyYY.c @@ -66,7 +66,6 @@ "x" STRINGIZE(FUNCTION_NAME)); exit (13); } - errno = 0; status = REENTRANT_NAME(ARG_NAME, result, buffer, length, &resbuf); if ((0 == status) && (resbuf == result)) { @@ -78,7 +77,7 @@ return ret_result; } - if (ERANGE != errno) { + if (ERANGE != status) { free (buffer); free (result); return NULL;