]> granicus.if.org Git - sudo/commitdiff
Linux getgrouplist(3) returns the number of groups on success instead
authorTodd C. Miller <Todd.Miller@sudo.ws>
Mon, 23 Jul 2018 13:23:17 +0000 (07:23 -0600)
committerTodd C. Miller <Todd.Miller@sudo.ws>
Mon, 23 Jul 2018 13:23:17 +0000 (07:23 -0600)
of 0 like BSD.

lib/util/getgrouplist.c

index ed4d58231c0adef0f80490b39a459a9cf5e8d34d..ce4e6d063b03c7c3ac56a6671a302364cebb0ce6 100644 (file)
@@ -97,7 +97,7 @@ sudo_getgrouplist2_v1(const char *name, GETGROUPS_T basegid,
            return -1;
        grpsize <<= 1;
        ngroups = grpsize;
-       if (getgrouplist(name, basegid, groups, &ngroups) == 0) {
+       if (getgrouplist(name, basegid, groups, &ngroups) != -1) {
            *groupsp = groups;
            *ngroupsp = ngroups;
            return 0;