Bug 172276 - POSIX: {get,set}groups gidsetsize is u_int not int
Summary: POSIX: {get,set}groups gidsetsize is u_int not int
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: standards (show other bugs)
Version: 9.0-STABLE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-standards (Nobody)
Keywords: patch
Depends on:
Reported: 2012-10-02 17:00 UTC by Ed Maste
Modified: 2021-08-07 00:08 UTC (History)
0 users

See Also:

getsetgroups_arg.diff (2.87 KB, patch)
2012-10-02 17:00 UTC, Ed Maste
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ed Maste freebsd_committer 2012-10-02 17:00:21 UTC
GNU Autoconf doesn't like our getgroups:

  On some platforms, this function fails to reject a negative count,
  even though that is less than the size that would be returned:

Run gnulib autoconf,
configure:54098: checking whether getgroups handles negative values

Comment 1 Eitan Adler freebsd_committer freebsd_triage 2018-05-23 10:27:56 UTC
batch change of PRs untouched in 2018 marked "in progress" back to open.
Comment 2 Ed Maste freebsd_committer 2021-08-07 00:08:10 UTC
Fixed by:

commit 4bc2174a1b489c36195ccc8cfc15e0775b817c69
Author: Moritz Buhl <gh@moritzbuhl.de>
Date:   Tue Jul 9 17:03:37 2019 +0200

    kern: fail getgroup and setgroup with negative int
    Found using
    getgroups/setgroups want an int and therefore casting it to u_int
    resulted in `getgroups(-1, ...)` not returning -1 / errno = EINVAL.
    imp@ updated syscall.master and made changes markj@ suggested
    PR:                     189941
    Tested by:              imp@
    Reviewed by:            markj@
    Pull Request:           https://github.com/freebsd/freebsd-src/pull/407
    Differential Revision:  https://reviews.freebsd.org/D30617

commit 9f3d1a98dd17b9f02912aecab328fd0315d8ef35
Author: Warner Losh <imp@FreeBSD.org>
Date:   Wed Jun 2 12:06:13 2021 -0600

    regen after tweaks to getgroups and setgroups
    Sponsored by:           Netflix