aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2015-02-05 22:28:00 +0000
committerDimitry Andric <dim@FreeBSD.org>2015-02-05 22:28:00 +0000
commitbd496ef499cf63bd102f6a13aa2e64ef3464bff5 (patch)
tree1f079505900a745e6810e186e24fae7628e60b0a
parenta1324315e3ba9685b1cdd94d0fde1dadb06d3df4 (diff)
downloadsrc-bd496ef499cf63bd102f6a13aa2e64ef3464bff5.tar.gz
src-bd496ef499cf63bd102f6a13aa2e64ef3464bff5.zip
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
Notes
Notes: svn path=/head/; revision=278297
-rw-r--r--usr.sbin/syslogd/syslogd.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c
index d497fe1ef952..d7c281c0fee7 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++;