Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 9 Feb 2015 07:52:45 +0000 (UTC)
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r278437 - in stable: 10/usr.sbin/syslogd 9/usr.sbin/syslogd
Message-ID:  <201502090752.t197qjxK085593@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dim
Date: Mon Feb  9 07:52:45 2015
New Revision: 278437
URL: https://svnweb.freebsd.org/changeset/base/278437

Log:
  MFC r278297:
  
  Fix two clang 3.6.0 warnings in usr.sbin/syslogd:
  
  usr.sbin/syslogd/syslogd.c:1023:10: error: address of array 'f->f_prevline' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion]
  		    f->f_prevline && !strcmp(msg, f->f_prevline) &&
  		    ~~~^~~~~~~~~~
  usr.sbin/syslogd/syslogd.c:1178:16: error: address of array 'f->f_prevline' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion]
  	} else if (f->f_prevline) {
  	       ~~  ~~~^~~~~~~~~~
  
  In both cases, the f_prevline field of struct filed is a char array, so
  it can never be null.  Remove the checks.
  
  Reviewed by:	jilles
  Differential Revision: https://reviews.freebsd.org/D1716

Modified:
  stable/9/usr.sbin/syslogd/syslogd.c
Directory Properties:
  stable/9/usr.sbin/syslogd/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/10/usr.sbin/syslogd/syslogd.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/9/usr.sbin/syslogd/syslogd.c
==============================================================================
--- stable/9/usr.sbin/syslogd/syslogd.c	Mon Feb  9 07:49:41 2015	(r278436)
+++ stable/9/usr.sbin/syslogd/syslogd.c	Mon Feb  9 07:52:45 2015	(r278437)
@@ -1019,7 +1019,7 @@ logmsg(int pri, const char *msg, const c
 		 */
 		if (no_compress - (f->f_type != F_PIPE) < 1 &&
 		    (flags & MARK) == 0 && msglen == f->f_prevlen &&
-		    f->f_prevline && !strcmp(msg, f->f_prevline) &&
+		    !strcmp(msg, f->f_prevline) &&
 		    !strcasecmp(from, f->f_prevhost)) {
 			(void)strlcpy(f->f_lasttime, timestamp,
 				sizeof(f->f_lasttime));
@@ -1174,11 +1174,9 @@ fprintlog(struct filed *f, int flags, co
 		v->iov_base = repbuf;
 		v->iov_len = snprintf(repbuf, sizeof repbuf,
 		    "last message repeated %d times", f->f_prevcount);
-	} else if (f->f_prevline) {
+	} else {
 		v->iov_base = f->f_prevline;
 		v->iov_len = f->f_prevlen;
-	} else {
-		return;
 	}
 	v++;
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201502090752.t197qjxK085593>