shadow/backport-Handle-ERANGE-error-correctly.patch

39 lines
1.1 KiB
Diff
Raw Normal View History

From e9bf727253e13968c4c61d71f4725e668cd49881 Mon Sep 17 00:00:00 2001
From: Niko <2089413+NikoDelarich@users.noreply.github.com>
Date: Tue, 1 Mar 2022 14:43:07 +0100
Subject: [PATCH] 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.
Reference: https://github.com/shadow-maint/shadow/commit/e9bf727253e13968c4c61d71f4725e668cd49881
Conflict: NA
---
libmisc/xgetXXbyYY.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/libmisc/xgetXXbyYY.c b/libmisc/xgetXXbyYY.c
index db010224..6a3f9693 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;
--
2.27.0