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 1/3] mount: fix compilation if __GLIBC__ is not defined
Date: Mon, 26 Aug 2019 09:48:50 +0200	[thread overview]
Message-ID: <6de0089348765e60bcdf59ef5813d7bb631c967f.1566805721.git.ps@pks.im> (raw)

As glibc versions before v2.24 couldn't safely include <linux/in6.h>,
commit 8af595b7 (mount: support compiling with old glibc, 2017-07-26)
introduced some preprocessor checks to special-case such old versions.
While there is a check whether __GLIBC__ is defined at all, it only
applies to the first comparison `__GLIBC__ < 2`, but doesn't apply to
the second check due to operator precedence. Thus the preprocessor may
use an undefined value and thus generate an error if __GLIBC__ is not
defined.

Fix the issue by wrapping the version check in braces.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 utils/mount/network.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/utils/mount/network.c b/utils/mount/network.c
index e166a823..6ac913d9 100644
--- a/utils/mount/network.c
+++ b/utils/mount/network.c
@@ -39,7 +39,7 @@
 #include <sys/socket.h>
 #include <sys/wait.h>
 #include <sys/stat.h>
-#if defined(__GLIBC__) && (__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 24)
+#if defined(__GLIBC__) && ((__GLIBC__ < 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 24))
 /* Cannot safely include linux/in6.h in old glibc, so hardcode the needed values */
 # define IPV6_PREFER_SRC_PUBLIC 2
 # define IPV6_ADDR_PREFERENCES 72
-- 
2.23.0


             reply	other threads:[~2019-08-26  7:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-26  7:48 Patrick Steinhardt [this message]
2019-08-26  7:48 ` [PATCH 2/3] nfsdcld: add missing include for PATH_MAX Patrick Steinhardt
2019-08-26 18:03   ` Steve Dickson
2019-08-26  7:48 ` [PATCH 3/3] tests: add missing include for strerror(3P) Patrick Steinhardt
2019-08-26 18:03   ` Steve Dickson
2019-08-26 18:03 ` [PATCH 1/3] mount: fix compilation if __GLIBC__ is not defined 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=6de0089348765e60bcdf59ef5813d7bb631c967f.1566805721.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).