From owner-svn-src-head@freebsd.org Sat Apr 15 02:24:23 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B7770D3E894; Sat, 15 Apr 2017 02:24:23 +0000 (UTC) (envelope-from sobomax@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 80B85C55; Sat, 15 Apr 2017 02:24:23 +0000 (UTC) (envelope-from sobomax@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3F2OMV9070093; Sat, 15 Apr 2017 02:24:22 GMT (envelope-from sobomax@FreeBSD.org) Received: (from sobomax@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3F2OMQq070092; Sat, 15 Apr 2017 02:24:22 GMT (envelope-from sobomax@FreeBSD.org) Message-Id: <201704150224.v3F2OMQq070092@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sobomax set sender to sobomax@FreeBSD.org using -f From: Maxim Sobolev Date: Sat, 15 Apr 2017 02:24:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r316951 - head/usr.sbin/syslogd X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Apr 2017 02:24:23 -0000 Author: sobomax Date: Sat Apr 15 02:24:22 2017 New Revision: 316951 URL: https://svnweb.freebsd.org/changeset/base/316951 Log: 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 Modified: head/usr.sbin/syslogd/syslogd.c Modified: head/usr.sbin/syslogd/syslogd.c ============================================================================== --- head/usr.sbin/syslogd/syslogd.c Sat Apr 15 01:52:49 2017 (r316950) +++ head/usr.sbin/syslogd/syslogd.c Sat Apr 15 02:24:22 2017 (r316951) @@ -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);