Hi,

In sendsyslog(2) I got the plural s of messages right.  The messages
of syslogd(8) should be alike.

ok?

bluhm

Index: usr.sbin/syslogd/syslogd.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/usr.sbin/syslogd/syslogd.c,v
retrieving revision 1.182
diff -u -p -r1.182 syslogd.c
--- usr.sbin/syslogd/syslogd.c  3 Sep 2015 14:50:53 -0000       1.182
+++ usr.sbin/syslogd/syslogd.c  3 Sep 2015 14:52:54 -0000
@@ -1155,8 +1155,10 @@ tcp_writecb(struct bufferevent *bufev, v
        if (f->f_un.f_forw.f_dropped > 0 &&
            EVBUFFER_LENGTH(f->f_un.f_forw.f_bufev->output) < MAX_TCPBUF) {
                snprintf(ebuf, sizeof(ebuf),
-                   "syslogd: dropped %d messages to loghost \"%s\"",
-                   f->f_un.f_forw.f_dropped, f->f_un.f_forw.f_loghost);
+                   "syslogd: dropped %d message%s to loghost \"%s\"",
+                   f->f_un.f_forw.f_dropped,
+                   f->f_un.f_forw.f_dropped == 1 ? "" : "s",
+                   f->f_un.f_forw.f_loghost);
                f->f_un.f_forw.f_dropped = 0;
                logmsg(LOG_SYSLOG|LOG_WARNING, ebuf, LocalHostName, ADDDATE);
        }
@@ -1863,8 +1865,8 @@ init_signalcb(int signum, short event, v
 
        if (tcpbuf_dropped > 0) {
                snprintf(ebuf, sizeof(ebuf),
-                   "syslogd: dropped %d messages to remote loghost",
-                   tcpbuf_dropped);
+                   "syslogd: dropped %d message%s to remote loghost",
+                   tcpbuf_dropped, tcpbuf_dropped == 1 ? "" : "s");
                tcpbuf_dropped = 0;
                logmsg(LOG_SYSLOG|LOG_WARNING, ebuf, LocalHostName, ADDDATE);
        }
@@ -1913,8 +1915,8 @@ die(int signo)
 
        if (tcpbuf_dropped > 0) {
                snprintf(ebuf, sizeof(ebuf),
-                   "syslogd: dropped %d messages to remote loghost",
-                   tcpbuf_dropped);
+                   "syslogd: dropped %d message%s to remote loghost",
+                   tcpbuf_dropped, tcpbuf_dropped == 1 ? "" : "s");
                tcpbuf_dropped = 0;
                logmsg(LOG_SYSLOG|LOG_WARNING, ebuf, LocalHostName, ADDDATE);
        }

Reply via email to