cmake: Add check for setgroups prototype.
authorAndreas Schneider <asn@cryptomilk.org>
Fri, 15 Nov 2013 08:36:54 +0000 (09:36 +0100)
committerAndreas Schneider <asn@cryptomilk.org>
Fri, 15 Nov 2013 08:36:54 +0000 (09:36 +0100)
ConfigureChecks.cmake
config.h.cmake
src/uid_wrapper.c

index 337314c7d68c64e59d059bed53237827598cd975..f85a125cde085b3f257ca423a9891c2bc683ecef 100644 (file)
@@ -69,6 +69,14 @@ check_function_exists(setregid HAVE_SETRESGID)
 check_function_exists(getgroups HAVE_GETGROUPS)
 check_function_exists(setgroups HAVE_SETGROUPS)
 
+if (HAVE_SETGROUPS)
+    check_prototype_definition(setgroups
+        "int setgroups(int size, const gid_t *list)"
+        "-1"
+        "unistd.h"
+        HAVE_SETGROUPS_INT)
+endif (HAVE_SETGROUPS)
+
 check_function_exists(syscall HAVE_SYSCALL)
 
 if (HAVE_SYSCALL)
index 591553ca7e3287e20a2900a3077eaee265279170..f9a3c72674153d015d95c1d7c295ec18ae1b2266 100644 (file)
 /* Define to 1 if you have the `setresgid' function. */
 #cmakedefine HAVE_SETREGID 1
 
+/* Define to 1 if you have the `setgroups' function. */
+#cmakedefine HAVE_SETGROUPS 1
+#cmakedefine HAVE_SETGROUPS_INT 1
+
 /* Define to 1 if you have the `syscall' function. */
 #cmakedefine HAVE_SYSCALL 1
 
index 971932f7d099d02f4ad5ac03282f1e9aa4826679..8a1651362d53ffc1e72a03db3f57cf20b8758fa7 100644 (file)
@@ -758,7 +758,11 @@ out:
        return rc;
 }
 
+#ifdef HAVE_SETGROUPS_INT
+int setgroups(int size, const gid_t *list)
+#else
 int setgroups(size_t size, const gid_t *list)
+#endif
 {
        if (!uwrap_enabled()) {
                return uwrap.libc.fns._libc_setgroups(size, list);