svn commit: r316973 - head/usr.sbin/syslogd
Maxim Sobolev
sobomax at FreeBSD.org
Sat Apr 15 18:20:12 UTC 2017
Author: sobomax
Date: Sat Apr 15 18:20:11 2017
New Revision: 316973
URL: https://svnweb.freebsd.org/changeset/base/316973
Log:
Fix another logic bug that came out of recent syslogd refactoring and exposed by
the r316874: don't call shutdown(2) on all sockets, but only net ones, which seems
to be the behaviour existed before that refactoring. Also don't call listen(2)
in datagram sockets and fix misplaced debug messages while I am here.
Reported by: peter
Modified:
head/usr.sbin/syslogd/syslogd.c
Modified: head/usr.sbin/syslogd/syslogd.c
==============================================================================
--- head/usr.sbin/syslogd/syslogd.c Sat Apr 15 17:02:32 2017 (r316972)
+++ head/usr.sbin/syslogd/syslogd.c Sat Apr 15 18:20:11 2017 (r316973)
@@ -3003,10 +3003,14 @@ socksetup(struct peer *pe)
continue;
}
dprintf("new socket fd is %d\n", s);
- listen(s, 5);
+ if (res->ai_socktype != SOCK_DGRAM) {
+ listen(s, 5);
+ }
sl_recv = socklist_recv_sock;
- dprintf("shutdown\n");
- if (SecureMode || res->ai_family == AF_LOCAL) {
+#if defined(INET) || defined(INET6)
+ if (SecureMode && (res->ai_family == AF_INET ||
+ res->ai_family == AF_INET6)) {
+ dprintf("shutdown\n");
/* Forbid communication in secure mode. */
if (shutdown(s, SHUT_RD) < 0 &&
errno != ENOTCONN) {
@@ -3014,10 +3018,11 @@ socksetup(struct peer *pe)
if (!Debug)
die(0);
}
- dprintf("listening on socket\n");
sl_recv = NULL;
} else
- dprintf("sending on socket\n");
+#endif
+ dprintf("listening on socket\n");
+ dprintf("sending on socket\n");
addsock(res->ai_addr, res->ai_addrlen,
&(struct socklist){
.sl_socket = s,
More information about the svn-src-all
mailing list