[compiler-rt] 6b12043 - [test][sanitizer] Fix getgrouplist test

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 10 15:48:52 PDT 2022


Author: Vitaly Buka
Date: 2022-08-10T15:48:44-07:00
New Revision: 6b12043bebd6226f6fe9b6aab773eaedac7acf11

URL: https://github.com/llvm/llvm-project/commit/6b12043bebd6226f6fe9b6aab773eaedac7acf11
DIFF: https://github.com/llvm/llvm-project/commit/6b12043bebd6226f6fe9b6aab773eaedac7acf11.diff

LOG: [test][sanitizer] Fix getgrouplist test

Added: 
    

Modified: 
    compiler-rt/test/sanitizer_common/TestCases/Linux/getgrouplist.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/test/sanitizer_common/TestCases/Linux/getgrouplist.cpp b/compiler-rt/test/sanitizer_common/TestCases/Linux/getgrouplist.cpp
index 475740fd2ff76..c27b6034cafef 100644
--- a/compiler-rt/test/sanitizer_common/TestCases/Linux/getgrouplist.cpp
+++ b/compiler-rt/test/sanitizer_common/TestCases/Linux/getgrouplist.cpp
@@ -1,6 +1,6 @@
 // RUN: %clangxx -O0 -g %s -o %t && %run %t
 //
-// REQUIRES: linux, freebsd, netbsd
+// REQUIRES: linux || freebsd || netbsd
 
 #include <stdlib.h>
 #include <unistd.h>
@@ -8,7 +8,7 @@
 
 int main(void) {
   gid_t *groups;
-  gid_t nobody;
+  group *nobody;
   int ngroups;
 
   ngroups = sysconf(_SC_NGROUPS_MAX);
@@ -16,10 +16,10 @@ int main(void) {
   if (!groups)
     exit(1);
 
-  if (gid_from_group("nobody", &nobody) == -1)
+  if (!(nobody = getgrnam("nobody")))
     exit(1);
 
-  if (getgrouplist("nobody", nobody, groups, &ngroups))
+  if (getgrouplist("nobody", nobody->gr_gid, groups, &ngroups) == -1)
     exit(1);
 
   if (groups && ngroups) {


        


More information about the llvm-commits mailing list