Details

[Home]

Issue of the Standard # S0177

Brief

getgrouplist() returns 1, if user does not refer to a valid user on the system

Detailed Description

According to LSB 3.1 standard, "if user does not refer to a valid user on the system, getgrouplist() shall return 0, and set the value referenced by ngroups to 0". But in the following code getgrouplist() returns 1 in this case and it also sets the value referenced by ngroups to 1. This contradicts the standard.

#include <stdio.h> #include <grp.h> #include <sys/types.h> int main(int argc, char* argv[]) { int res; gid_t groups[20]; int ngroups=20; res = getgrouplist("BadBadBadUser", 100, groups, &ngroups); printf("res=%d\n", res); printf("ngroups=%d\n", ngroups); return 0; }

Problem location(s) in the standard

Linux Standard Base Core Specification 3.1, Chapter 13. Base Libraries, 13.5. Interface Definitions for libc, description of bind_textdomain_codeset().

Possible solutions

LSB standard correction

References

No references found

Accepted

LSB Bugzilla, 1640

Status

Fixed in LSB 3.1 Update 1

[Home]