linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: linux-nfs@vger.kernel.org
Cc: Patrick Steinhardt <ps@pks.im>
Subject: [PATCH 4/6] configure.ac: Add <sys/socket.h> header when checking sizeof(socklen_t)
Date: Wed, 28 Aug 2019 09:10:15 +0200	[thread overview]
Message-ID: <42879dea46c255025fb579dcf7b15335fd77291c.1566976047.git.ps@pks.im> (raw)
In-Reply-To: <cover.1566976047.git.ps@pks.im>

We're checking for various sizes in configure.ac, among them the size of
the socklen_t type. If socklen_t's size is not found and thus reported
to be zero, we will typedef our own socklen_t as "unsigned int".

The check for socklen_t is insufficient, though. While the type is
declared via <sys/socket.h>, we only search AC_INCLUDES_DEFAULT for its
declaration, which doesn't include <sys/socket.h>. On musl libc, this
causes us to not find the declaration and redeclare it with an
incompatible type.

Fix the issue by searching both the default includes as well as
<sys/socket.h>.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 configure.ac | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 50002b4a..37096944 100644
--- a/configure.ac
+++ b/configure.ac
@@ -545,7 +545,10 @@ AC_CHECK_SIZEOF(short)
 AC_CHECK_SIZEOF(int)
 AC_CHECK_SIZEOF(long)
 AC_CHECK_SIZEOF(size_t)
-AC_CHECK_SIZEOF(socklen_t)
+AC_CHECK_SIZEOF(socklen_t,, [AC_INCLUDES_DEFAULT
+                             #ifdef HAVE_SYS_SOCKET_H
+                             # include <sys/socket.h>
+                             #endif])
 
 
 dnl *************************************************************
-- 
2.23.0


  parent reply	other threads:[~2019-08-28  7:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-28  7:10 [PATCH 0/6] Fixes for various compiler warnings Patrick Steinhardt
2019-08-28  7:10 ` [PATCH 1/6] Annotate unused fields with UNUSED Patrick Steinhardt
2019-08-28  7:10 ` [PATCH 2/6] Use <fcntl.h> header instead of <sys/fcntl.h> Patrick Steinhardt
2019-08-28  7:10 ` [PATCH 3/6] Use <poll.h> header instead of <sys/poll.h> Patrick Steinhardt
2019-08-28  7:10 ` Patrick Steinhardt [this message]
2019-08-28  7:10 ` [PATCH 5/6] nfsd_path: Include missing header for `struct stat` Patrick Steinhardt
2019-08-28  7:10 ` [PATCH 6/6] mountd: Use unsigned for filesystem type magic constants Patrick Steinhardt
2019-09-05 12:07 ` [PATCH 0/6] Fixes for various compiler warnings Steve Dickson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=42879dea46c255025fb579dcf7b15335fd77291c.1566976047.git.ps@pks.im \
    --to=ps@pks.im \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).