]> git.ipfire.org Git - thirdparty/glibc.git/commit - nss/tst-sgetsgent.c
gshadow: Matching sgetsgent, sgetsgent_r ERANGE handling (bug 30151)
authorFlorian Weimer <fweimer@redhat.com>
Tue, 21 Feb 2023 08:20:28 +0000 (09:20 +0100)
committerFlorian Weimer <fweimer@redhat.com>
Tue, 7 Mar 2023 09:01:44 +0000 (10:01 +0100)
commit969e9733c7d17edf1e239a73fa172f357561f440
tree0b7fc604681dafe3fa4f2eec0b60d2a20f833325
parent8390014c2320f94ffd8a8f6088c10c1f64567954
gshadow: Matching sgetsgent, sgetsgent_r ERANGE handling (bug 30151)

Before this change, sgetsgent_r did not set errno to ERANGE, but
sgetsgent only check errno, not the return value from sgetsgent_r.
Consequently, sgetsgent did not detect any error, and reported
success to the caller, without initializing the struct sgrp object
whose address was returned.

This commit changes sgetsgent_r to set errno as well.  This avoids
similar issues in applications which only change errno.

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
gshadow/Makefile
gshadow/sgetsgent_r.c
gshadow/tst-sgetsgent.c [new file with mode: 0644]