1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Check for struct ucred with AC_CHECK_TYPES (#13510)

The AC_CHECK_TYPES can be used to check for the struct ucred. By
default it defines the symbol HAVE_STRUCT_UCRED instead of
ANC_CREDS_UCRED.
This commit is contained in:
Peter Kokot
2024-02-25 23:02:17 +01:00
committed by GitHub
parent c1d6cf37e9
commit 0039446fee
2 changed files with 7 additions and 17 deletions

View File

@@ -51,22 +51,12 @@ if test "$PHP_SOCKETS" != "no"; then
AC_DEFINE(HAVE_AI_IDN,1,[Whether you have AI_IDN])
fi
dnl Check for struct ucred
dnl checking the header is not enough (eg DragonFlyBSD)
AC_CACHE_CHECK([if ancillary credentials uses ucred],[ac_cv_ucred],
[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include <sys/socket.h>
]], [[struct ucred u = {.gid = 0};]])],
[ac_cv_ucred=yes], [ac_cv_ucred=no])
])
if test "$ac_cv_ucred" = yes; then
AC_DEFINE(ANC_CREDS_UCRED,1,[Uses ucred struct])
fi
dnl Check for struct ucred. Checking the header is not enough (DragonFlyBSD).
AC_CHECK_TYPES([struct ucred],,,
[#ifndef _GNU_SOURCE
# define _GNU_SOURCE
#endif
#include <sys/socket.h>])
AC_CHECK_TYPES([struct cmsgcred],,,[#include <sys/socket.h>])

View File

@@ -123,7 +123,7 @@ static void init_ancillary_registry(void)
#endif
#ifdef SO_PASSCRED
#ifdef ANC_CREDS_UCRED
#ifdef HAVE_STRUCT_UCRED
PUT_ENTRY(sizeof(struct ucred), 0, 0, from_zval_write_ucred,
to_zval_read_ucred, SOL_SOCKET, SCM_CREDENTIALS);
#else