[PATCH] nwrap: fix comparison, spotted by -Werror=pointer-compare

Ralph Böhme slow at samba.org
Sun Aug 27 19:08:51 UTC 2017


Hi!

Attached is a simple fix for nsswrapper. Ran into this after upgrading to Fedora
26. Please review&push if ok.

Cheerio!
-slow
-------------- next part --------------
From 168cd1e5563bd3fe49953822fcc034178ba48904 Mon Sep 17 00:00:00 2001
From: Ralph Boehme <slow at samba.org>
Date: Sun, 27 Aug 2017 19:39:22 +0200
Subject: [PATCH] nwrap: fix comparison, spotted by -Werror=pointer-compare
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

../lib/nss_wrapper/nss_wrapper.c: In function ‘nwrap_init’:
../lib/nss_wrapper/nss_wrapper.c:1571:13: error: comparison between
pointer and zero character constant [-Werror=pointer-compare]
   if (((env != '\0') && (endptr == '\0')) ||

Signed-off-by: Ralph Boehme <slow at samba.org>
---
 src/nss_wrapper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/nss_wrapper.c b/src/nss_wrapper.c
index 70a5989..d10d4a7 100644
--- a/src/nss_wrapper.c
+++ b/src/nss_wrapper.c
@@ -1577,7 +1577,7 @@ static void nwrap_init(void)
 	env = getenv("NSS_WRAPPER_MAX_HOSTENTS");
 	if (env != NULL) {
 		max_hostents_tmp = (size_t)strtol(env, &endptr, 10);
-		if (((env != '\0') && (endptr == '\0')) ||
+		if (((env[0] != '\0') && (endptr[0] == '\0')) ||
 		    (max_hostents_tmp == 0)) {
 			NWRAP_LOG(NWRAP_LOG_DEBUG,
 				  "Error parsing NSS_WRAPPER_MAX_HOSTENTS "
-- 
2.13.5



More information about the samba-technical mailing list