瀏覽代碼

add support for newer [sg]etgroups function and make the function a simple passthrough on 64bit arches (should fix the getgroup crashes in ltp)

Mike Frysinger 18 年之前
父節點
當前提交
c7dec4ce77
共有 2 個文件被更改,包括 24 次插入1 次删除
  1. 12 1
      libc/sysdeps/linux/common/getgroups.c
  2. 12 0
      libc/sysdeps/linux/common/setgroups.c

+ 12 - 1
libc/sysdeps/linux/common/getgroups.c

@@ -14,8 +14,17 @@
 
 libc_hidden_proto(getgroups)
 
-libc_hidden_proto(sysconf)
+#if defined(__NR_getgroups32)
+# undef __NR_getgroups
+# define __NR_getgroups __NR_getgroups32
+_syscall2(int, getgroups, int, size, gid_t *, list);
+
+#elif __WORDSIZE == 64
+_syscall2(int, getgroups, int, size, gid_t *, list);
+
+#else
 
+libc_hidden_proto(sysconf)
 #define MIN(a,b) (((a)<(b))?(a):(b))
 
 #define __NR___syscall_getgroups __NR_getgroups
@@ -49,4 +58,6 @@ ret_error:
 		return ngids;
 	}
 }
+#endif
+
 libc_hidden_def(getgroups)

+ 12 - 0
libc/sysdeps/linux/common/setgroups.c

@@ -14,6 +14,16 @@
 
 libc_hidden_proto(setgroups)
 
+#if defined(__NR_setgroups32)
+# undef __NR_setgroups
+# define __NR_setgroups __NR_setgroups32
+_syscall2(int, setgroups, size_t, size, const gid_t *, list);
+
+#elif __WORDSIZE == 64
+_syscall2(int, setgroups, size_t, size, const gid_t *, list);
+
+#else
+
 libc_hidden_proto(sysconf)
 
 #define __NR___syscall_setgroups __NR_setgroups
@@ -49,4 +59,6 @@ ret_error:
 		return i;
 	}
 }
+#endif
+
 libc_hidden_def(setgroups)