Since shutdown(2) on datagram socket is no longer a NOP after rev 316874

don't bother to select/recv on that socket. This prevents syslogd(8)
from spinning endlessly when started with the -s option (default).

Reported by:	peter
This commit is contained in:
Maxim Sobolev 2017-04-15 02:24:22 +00:00
parent 6029706346
commit b98582b146
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=316951

View File

@ -702,7 +702,7 @@ main(int argc, char *argv[])
sizeof(fd_mask));
STAILQ_FOREACH(sl, &shead, next) {
if (sl->sl_socket != -1)
if (sl->sl_socket != -1 && sl->sl_recv != NULL)
FD_SET(sl->sl_socket, fdsr);
}
i = select(fdsrmax + 1, fdsr, NULL, NULL,
@ -2877,6 +2877,7 @@ socksetup(struct peer *pe)
struct addrinfo hints, *res, *res0;
int error;
char *cp;
int (*sl_recv)(struct socklist *);
/*
* We have to handle this case for backwards compatibility:
* If there are two (or more) colons but no '[' and ']',
@ -3003,6 +3004,7 @@ socksetup(struct peer *pe)
}
dprintf("new socket fd is %d\n", s);
listen(s, 5);
sl_recv = socklist_recv_sock;
dprintf("shutdown\n");
if (SecureMode || res->ai_family == AF_LOCAL) {
/* Forbid communication in secure mode. */
@ -3013,13 +3015,14 @@ socksetup(struct peer *pe)
die(0);
}
dprintf("listening on socket\n");
sl_recv = NULL;
} else
dprintf("sending on socket\n");
addsock(res->ai_addr, res->ai_addrlen,
&(struct socklist){
.sl_socket = s,
.sl_peer = pe,
.sl_recv = socklist_recv_sock
.sl_recv = sl_recv
});
}
freeaddrinfo(res0);