]> granicus.if.org Git - sudo/commitdiff
Skip sudo_getgrouplist2() check on systems with getgrouplist_2().
authorTodd C. Miller <Todd.Miller@sudo.ws>
Fri, 26 Oct 2018 17:11:58 +0000 (11:11 -0600)
committerTodd C. Miller <Todd.Miller@sudo.ws>
Fri, 26 Oct 2018 17:11:58 +0000 (11:11 -0600)
sudo_getgrouplist2() is just a wrapper on such systems and this
avoids a test failure on macOS where a user is automatically a
member of certain groups.

lib/util/regress/getgrouplist/getgrouplist_test.c

index a88d80b13e11ad51455e36b6962ad976879243c4..4d44cf2f6db55290bb1b5bbe3606f81f207cb1a2 100644 (file)
@@ -46,11 +46,13 @@ __dso_public int main(int argc, char *argv[]);
 int
 main(int argc, char *argv[])
 {
+    int errors = 0;
+#ifndef HAVE_GETGROUPLIST_2
     GETGROUPS_T *groups = NULL;
     struct passwd *pw;
     struct group *grp;
     char *username;
-    int i, j, errors = 0, ntests = 0;
+    int i, j, ntests = 0;
     int ngroups;
     gid_t basegid;
     initprogname(argc > 0 ? argv[0] : "getgrouplist_test");
@@ -97,5 +99,6 @@ main(int argc, char *argv[])
        printf("%s: %d tests run, %d errors, %d%% success rate\n",
            getprogname(), ntests, errors, (ntests - errors) * 100 / ntests);
     }
+#endif /* HAVE_GETGROUPLIST_2 */
     exit(errors);
 }