diff options
author | dim <dim@FreeBSD.org> | 2015-02-09 07:52:45 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2015-02-09 07:52:45 +0000 |
commit | 66970811c14d11c0b25162c408dfd99e0d73642d (patch) | |
tree | fab28c380956d985f421d5700e73b04ed098ef35 | |
parent | 45a867d42907537eaa6f3a83829c45ddbd476e8a (diff) | |
download | FreeBSD-src-66970811c14d11c0b25162c408dfd99e0d73642d.zip FreeBSD-src-66970811c14d11c0b25162c408dfd99e0d73642d.tar.gz |
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
-rw-r--r-- | usr.sbin/syslogd/syslogd.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c index d497fe1..d7c281c 100644 --- a/usr.sbin/syslogd/syslogd.c +++ b/usr.sbin/syslogd/syslogd.c @@ -1020,7 +1020,7 @@ logmsg(int pri, const char *msg, const char *from, int flags) */ 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, const char *msg) 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++; |