]> git.ipfire.org Git - thirdparty/util-linux.git/commit
setpriv: Improve getgroups() Portability
authorKarel Zak <kzak@redhat.com>
Mon, 21 Jul 2025 06:16:25 +0000 (08:16 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 9 Sep 2025 10:02:49 +0000 (12:02 +0200)
commitcab14a338ee7bc753740d8becde7d44d122d0ca8
tree1f9d6d3b4399199d57d9288e2f55a3725334bfa1
parentb65fea8514d24c9da3ba9b39c956024ff680c3a8
setpriv: Improve getgroups() Portability

setpriv(1) is Linux-only, and on Linux, getgroups() returns at least one group.
However, it's better to use more portable and generic code patterns and assume
that getgroups() can return zero.

Fixes: https://github.com/util-linux/util-linux/issues/3654
Reported-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
(cherry picked from commit 434a5633a563066357bbc3f331838ed41041ec1a)
sys-utils/setpriv.c