From owner-svn-src-stable@FreeBSD.ORG Sun Jun 3 11:31:45 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id ABA7D106566B; Sun, 3 Jun 2012 11:31:45 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 969C78FC1B; Sun, 3 Jun 2012 11:31:45 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q53BVjki058409; Sun, 3 Jun 2012 11:31:45 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q53BVjw9058407; Sun, 3 Jun 2012 11:31:45 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201206031131.q53BVjw9058407@svn.freebsd.org> From: Jilles Tjoelker Date: Sun, 3 Jun 2012 11:31:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236510 - stable/8/lib/libfetch X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Jun 2012 11:31:45 -0000 Author: jilles Date: Sun Jun 3 11:31:45 2012 New Revision: 236510 URL: http://svn.freebsd.org/changeset/base/236510 Log: MFC r236193: libfetch: Avoid SIGPIPE on network connections. To avoid unexpected process termination from SIGPIPE when writing to a closed network connection, enable SO_NOSIGPIPE on all network connections. The POSIX standard MSG_NOSIGNAL is not used since it requires modifying all send calls to add this flag. This is particularly nasty for SSL connections. Modified: stable/8/lib/libfetch/common.c Directory Properties: stable/8/lib/libfetch/ (props changed) Modified: stable/8/lib/libfetch/common.c ============================================================================== --- stable/8/lib/libfetch/common.c Sun Jun 3 11:29:48 2012 (r236509) +++ stable/8/lib/libfetch/common.c Sun Jun 3 11:31:45 2012 (r236510) @@ -209,11 +209,13 @@ conn_t * fetch_reopen(int sd) { conn_t *conn; + int opt = 1; /* allocate and fill connection structure */ if ((conn = calloc(1, sizeof(*conn))) == NULL) return (NULL); fcntl(sd, F_SETFD, FD_CLOEXEC); + setsockopt(sd, SOL_SOCKET, SO_NOSIGPIPE, &opt, sizeof opt); conn->sd = sd; ++conn->ref; return (conn);