From owner-svn-src-head@freebsd.org Tue Oct 8 21:14:11 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DB3D0137242; Tue, 8 Oct 2019 21:14:11 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46nqpq5TGpz4Wdk; Tue, 8 Oct 2019 21:14:11 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9F1526333; Tue, 8 Oct 2019 21:14:11 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x98LEBer077228; Tue, 8 Oct 2019 21:14:11 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x98LEAuU077185; Tue, 8 Oct 2019 21:14:10 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201910082114.x98LEAuU077185@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Tue, 8 Oct 2019 21:14:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353326 - in head: contrib/sendmail/mail.local lib/libc/tests/nss usr.bin/tip/tip usr.sbin/fwcontrol X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: in head: contrib/sendmail/mail.local lib/libc/tests/nss usr.bin/tip/tip usr.sbin/fwcontrol X-SVN-Commit-Revision: 353326 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Oct 2019 21:14:11 -0000 Author: brooks Date: Tue Oct 8 21:14:09 2019 New Revision: 353326 URL: https://svnweb.freebsd.org/changeset/base/353326 Log: Fix various -Wpointer-compare warnings This warning (comparing a pointer against a zero character literal rather than NULL) has existed since GCC 7.1.0, and was recently added to Clang trunk. Almost all of these are harmless, except for fwcontrol's str2node, which needs to both guard against dereferencing a NULL pointer (though in practice it appears none of the callers will ever pass one in), as well as ensure it doesn't parse the empty string as node 0 due to strtol's awkward interface. Submitted by: James Clarke Obtained from: CheriBSD Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D21914 Modified: head/contrib/sendmail/mail.local/mail.local.c head/lib/libc/tests/nss/getgr_test.c head/lib/libc/tests/nss/getproto_test.c head/lib/libc/tests/nss/getrpc_test.c head/lib/libc/tests/nss/getserv_test.c head/usr.bin/tip/tip/acu.c head/usr.sbin/fwcontrol/fwcontrol.c Modified: head/contrib/sendmail/mail.local/mail.local.c ============================================================================== --- head/contrib/sendmail/mail.local/mail.local.c Tue Oct 8 20:59:31 2019 (r353325) +++ head/contrib/sendmail/mail.local/mail.local.c Tue Oct 8 21:14:09 2019 (r353326) @@ -393,7 +393,7 @@ main(argc, argv) } /* Non-LMTP from here on out */ - if (*argv == '\0') + if (*argv == NULL) usage(); /* Modified: head/lib/libc/tests/nss/getgr_test.c ============================================================================== --- head/lib/libc/tests/nss/getgr_test.c Tue Oct 8 20:59:31 2019 (r353325) +++ head/lib/libc/tests/nss/getgr_test.c Tue Oct 8 21:14:09 2019 (r353326) @@ -153,7 +153,7 @@ compare_group(struct group *grp1, struct group *grp2, if (strcmp(*c1, *c2) != 0) goto errfin; - if (*c1 != '\0' || *c2 != '\0') + if (*c1 != NULL || *c2 != NULL) goto errfin; return 0; @@ -182,7 +182,7 @@ sdump_group(struct group *grp, char *buffer, size_t bu buflen -= written; if (grp->gr_mem != NULL) { - if (*(grp->gr_mem) != '\0') { + if (*(grp->gr_mem) != NULL) { for (cp = grp->gr_mem; *cp; ++cp) { written = snprintf(buffer, buflen, "%s%s", cp == grp->gr_mem ? "" : ",", *cp); Modified: head/lib/libc/tests/nss/getproto_test.c ============================================================================== --- head/lib/libc/tests/nss/getproto_test.c Tue Oct 8 20:59:31 2019 (r353325) +++ head/lib/libc/tests/nss/getproto_test.c Tue Oct 8 21:14:09 2019 (r353326) @@ -148,7 +148,7 @@ compare_protoent(struct protoent *pe1, struct protoent if (strcmp(*c1, *c2) != 0) goto errfin; - if ((*c1 != '\0') || (*c2 != '\0')) + if ((*c1 != NULL) || (*c2 != NULL)) goto errfin; return 0; @@ -177,7 +177,7 @@ sdump_protoent(struct protoent *pe, char *buffer, size buflen -= written; if (pe->p_aliases != NULL) { - if (*(pe->p_aliases) != '\0') { + if (*(pe->p_aliases) != NULL) { for (cp = pe->p_aliases; *cp; ++cp) { written = snprintf(buffer, buflen, " %s", *cp); buffer += written; Modified: head/lib/libc/tests/nss/getrpc_test.c ============================================================================== --- head/lib/libc/tests/nss/getrpc_test.c Tue Oct 8 20:59:31 2019 (r353325) +++ head/lib/libc/tests/nss/getrpc_test.c Tue Oct 8 21:14:09 2019 (r353326) @@ -147,7 +147,7 @@ compare_rpcent(struct rpcent *rpc1, struct rpcent *rpc if (strcmp(*c1, *c2) != 0) goto errfin; - if ((*c1 != '\0') || (*c2 != '\0')) + if ((*c1 != NULL) || (*c2 != NULL)) goto errfin; return 0; @@ -176,7 +176,7 @@ sdump_rpcent(struct rpcent *rpc, char *buffer, size_t buflen -= written; if (rpc->r_aliases != NULL) { - if (*(rpc->r_aliases) != '\0') { + if (*(rpc->r_aliases) != NULL) { for (cp = rpc->r_aliases; *cp; ++cp) { written = snprintf(buffer, buflen, " %s", *cp); buffer += written; Modified: head/lib/libc/tests/nss/getserv_test.c ============================================================================== --- head/lib/libc/tests/nss/getserv_test.c Tue Oct 8 20:59:31 2019 (r353325) +++ head/lib/libc/tests/nss/getserv_test.c Tue Oct 8 21:14:09 2019 (r353326) @@ -153,7 +153,7 @@ compare_servent(struct servent *serv1, struct servent if (strcmp(*c1, *c2) != 0) goto errfin; - if ((*c1 != '\0') || (*c2 != '\0')) + if ((*c1 != NULL) || (*c2 != NULL)) goto errfin; return 0; @@ -182,7 +182,7 @@ sdump_servent(struct servent *serv, char *buffer, size buflen -= written; if (serv->s_aliases != NULL) { - if (*(serv->s_aliases) != '\0') { + if (*(serv->s_aliases) != NULL) { for (cp = serv->s_aliases; *cp; ++cp) { written = snprintf(buffer, buflen, " %s", *cp); buffer += written; Modified: head/usr.bin/tip/tip/acu.c ============================================================================== --- head/usr.bin/tip/tip/acu.c Tue Oct 8 20:59:31 2019 (r353325) +++ head/usr.bin/tip/tip/acu.c Tue Oct 8 21:14:09 2019 (r353326) @@ -190,7 +190,7 @@ acutype(char *s) acu_t *p; extern acu_t acutable[]; - for (p = acutable; p->acu_name != '\0'; p++) + for (p = acutable; p->acu_name != NULL; p++) if (!strcmp(s, p->acu_name)) return (p); return (NOACU); Modified: head/usr.sbin/fwcontrol/fwcontrol.c ============================================================================== --- head/usr.sbin/fwcontrol/fwcontrol.c Tue Oct 8 20:59:31 2019 (r353325) +++ head/usr.sbin/fwcontrol/fwcontrol.c Tue Oct 8 21:14:09 2019 (r353326) @@ -129,7 +129,7 @@ str2node(int fd, const char *nodestr) char *endptr; int i, node; - if (nodestr == '\0') + if (nodestr == NULL || *nodestr == '\0') return (-1); /*