svn commit: r278297 - head/usr.sbin/syslogd
Dimitry Andric
dim at FreeBSD.org
Thu Feb 5 22:28:01 UTC 2015
Author: dim
Date: Thu Feb 5 22:28:00 2015
New Revision: 278297
URL: https://svnweb.freebsd.org/changeset/base/278297
Log:
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
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D1716
Modified:
head/usr.sbin/syslogd/syslogd.c
Modified: head/usr.sbin/syslogd/syslogd.c
==============================================================================
--- head/usr.sbin/syslogd/syslogd.c Thu Feb 5 22:24:22 2015 (r278296)
+++ head/usr.sbin/syslogd/syslogd.c Thu Feb 5 22:28:00 2015 (r278297)
@@ -1020,7 +1020,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));
@@ -1175,11 +1175,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++;
More information about the svn-src-all
mailing list