Skip to content

Commit 5b268fa

Browse files
authored
Use AC_CHECK_MEMBERS instead of AC_EGREP_HEADER (#13048)
AC_EGREP_* macros are not recommended due to their unreliability in certain cases, checking for struct member can be done here using the usual AC_CHECK_MEMBERS instead. AC_CHECK_MEMBERS macro by default defines constant HAVE_STRUCT_SOCKADDR_UN_SUN_LEN.
1 parent ea6110f commit 5b268fa

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

main/fastcgi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,7 @@ int fcgi_listen(const char *path, int backlog)
745745
sa.sa_unix.sun_family = AF_UNIX;
746746
memcpy(sa.sa_unix.sun_path, path, path_len + 1);
747747
sock_len = (size_t)(((struct sockaddr_un *)0)->sun_path) + path_len;
748-
#ifdef HAVE_SOCKADDR_UN_SUN_LEN
748+
#ifdef HAVE_STRUCT_SOCKADDR_UN_SUN_LEN
749749
sa.sa_unix.sun_len = sock_len;
750750
#endif
751751
unlink(path);

sapi/cgi/config9.m4

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,8 @@ AC_MSG_CHECKING(for CGI build)
99
if test "$PHP_CGI" != "no"; then
1010
AC_MSG_RESULT(yes)
1111

12-
AC_MSG_CHECKING([for sun_len in sys/un.h])
13-
AC_EGREP_HEADER([sun_len], [sys/un.h],
14-
[AC_MSG_RESULT([yes])
15-
AC_DEFINE([HAVE_SOCKADDR_UN_SUN_LEN], [1],
16-
[Define if sockaddr_un in sys/un.h contains a sun_len component])],
17-
AC_MSG_RESULT([no]))
12+
dnl BSD systems.
13+
AC_CHECK_MEMBERS([struct sockaddr_un.sun_len],,,[#include <sys/un.h>])
1814

1915
AC_MSG_CHECKING([whether cross-process locking is required by accept()])
2016
case "`uname -sr`" in

0 commit comments

Comments
 (0)