This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/4527] New: getgrouplist() returns 1, if user does not refer to a valid user on the system


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;
}

-- 
           Summary: getgrouplist() returns 1, if user does not refer to a
                    valid user on the system
           Product: glibc
           Version: 2.4
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: lex at ispras dot ru
                CC: glibc-bugs at sources dot redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=4527

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]