summaryrefslogtreecommitdiff
path: root/source4/build/tests/getgroups.c
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2006-05-13 18:12:53 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:05:58 -0500
commit53f005f6aaa2aa2eb599e6787e2c700a1d44d2a2 (patch)
treed510574c7415fb019edccdb2df210ed2da26e5a7 /source4/build/tests/getgroups.c
parent089cbd4a8e8108306ba92b01746ecd261e9fdd7c (diff)
downloadsamba-53f005f6aaa2aa2eb599e6787e2c700a1d44d2a2.tar.gz
samba-53f005f6aaa2aa2eb599e6787e2c700a1d44d2a2.tar.bz2
samba-53f005f6aaa2aa2eb599e6787e2c700a1d44d2a2.zip
r15572: Trim build/m4/rewrite.m4 a bit more, remove unused tests.
(This used to be commit d72c5c8f755277eb22e1f6834d98202f00c09934)
Diffstat (limited to 'source4/build/tests/getgroups.c')
-rw-r--r--source4/build/tests/getgroups.c66
1 files changed, 0 insertions, 66 deletions
diff --git a/source4/build/tests/getgroups.c b/source4/build/tests/getgroups.c
deleted file mode 100644
index 343fd5a184..0000000000
--- a/source4/build/tests/getgroups.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/* this tests whether getgroups actually returns lists of integers
- rather than gid_t. The test only works if the user running
- the test is in at least 1 group
-
- The test is designed to check for those broken OSes that define
- getgroups() as returning an array of gid_t but actually return a
- array of ints! Ultrix is one culprit
- */
-
-#if defined(HAVE_UNISTD_H)
-#include <unistd.h>
-#endif
-
-#include <sys/types.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <grp.h>
-
-main()
-{
- int i;
- int *igroups;
- char *cgroups;
- int grp = 0;
- int ngroups = getgroups(0,&grp);
-
- if (sizeof(gid_t) == sizeof(int)) {
- fprintf(stderr,"gid_t and int are the same size\n");
- exit(1);
- }
-
- if (ngroups <= 0)
- ngroups = 32;
-
- igroups = (int *)malloc(sizeof(int)*ngroups);
-
- for (i=0;i<ngroups;i++)
- igroups[i] = 0x42424242;
-
- ngroups = getgroups(ngroups,(gid_t *)igroups);
-
- if (igroups[0] == 0x42424242)
- ngroups = 0;
-
- if (ngroups == 0) {
- printf("WARNING: can't determine getgroups return type\n");
- exit(1);
- }
-
- cgroups = (char *)igroups;
-
- if (ngroups == 1 &&
- cgroups[2] == 0x42 && cgroups[3] == 0x42) {
- fprintf(stderr,"getgroups returns gid_t\n");
- exit(1);
- }
-
- for (i=0;i<ngroups;i++) {
- if (igroups[i] == 0x42424242) {
- fprintf(stderr,"getgroups returns gid_t\n");
- exit(1);
- }
- }
-
- exit(0);
-}