mirror of
https://github.com/samba-team/samba.git
synced 2025-01-13 13:18:06 +03:00
3a9a3ad8f9
configure.in determines if -Werror-implicit-function-declaration is available, and if so it enables that flag if --enable-developer is specified. Since the configure tests themselves did not use that flag, it was possible for a configure test to succeed, followed by a failed compilation due to a facility being available but not having a proper declaration in a header file. (This bit me with readahead().) This patch ensures that if implicit function declarations will kill the build, the feature being tested is deselected so the build will succeed. The autoconf manual suggests using return instead of exit in configure tests because the declaration for exit is often missing. We require this now, since we error if prototypes are missing. See section 5.5.1 of http://www.gnu.org/software/autoconf/manual/autoconf.html. This patch makes these changes, because in fact, an external declaration for exit is missing here (and likely elsewhere). I've verified that the features selected (here) with the original configure.in and the new one are the same except for, in my case, readahead. I've also confirmed that the generated Makefile is identical. These changes are not being applied to the 3.0.26 branch because it does not exhibit the initial problem this patch is supposed to solve since it doesn't attempt to use -Werror-implicit-function-declaration. (This used to be commit 4d42720915b8f65842147171f689127e94d1b973)
71 lines
1.4 KiB
C
71 lines
1.4 KiB
C
/* 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
|
|
|
|
#if defined(HAVE_STDLIB_H)
|
|
#include <stdlib.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");
|
|
return 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");
|
|
return 1;
|
|
}
|
|
|
|
cgroups = (char *)igroups;
|
|
|
|
if (ngroups == 1 &&
|
|
cgroups[2] == 0x42 && cgroups[3] == 0x42) {
|
|
fprintf(stderr,"getgroups returns gid_t\n");
|
|
return 1;
|
|
}
|
|
|
|
for (i=0;i<ngroups;i++) {
|
|
if (igroups[i] == 0x42424242) {
|
|
fprintf(stderr,"getgroups returns gid_t\n");
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
return 0;
|
|
}
|