From owner-freebsd-net Wed Mar 19 1:37:51 2003 Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B310437B401 for ; Wed, 19 Mar 2003 01:37:50 -0800 (PST) Received: from xorpc.icir.org (xorpc.icir.org [192.150.187.68]) by mx1.FreeBSD.org (Postfix) with ESMTP id 43F7343F75 for ; Wed, 19 Mar 2003 01:37:50 -0800 (PST) (envelope-from rizzo@xorpc.icir.org) Received: from xorpc.icir.org (localhost [127.0.0.1]) by xorpc.icir.org (8.12.3/8.12.3) with ESMTP id h2J9bnAq084828; Wed, 19 Mar 2003 01:37:49 -0800 (PST) (envelope-from rizzo@xorpc.icir.org) Received: (from rizzo@localhost) by xorpc.icir.org (8.12.3/8.12.3/Submit) id h2J9bmOv084822; Wed, 19 Mar 2003 01:37:48 -0800 (PST) (envelope-from rizzo) Date: Wed, 19 Mar 2003 01:37:48 -0800 From: Luigi Rizzo To: Peter Pentchev Cc: net@FreeBSD.ORG, Tristan Goode Subject: Re: write(2) SIGPIPE on a closed socket? Message-ID: <20030319013748.A84035@xorpc.icir.org> References: <20030319093002.GT468@straylight.oblivion.bg> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <20030319093002.GT468@straylight.oblivion.bg>; from roam@ringlet.net on Wed, Mar 19, 2003 at 11:30:02AM +0200 Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org On Wed, Mar 19, 2003 at 11:30:02AM +0200, Peter Pentchev wrote: ... > dnscache) getting a SIGPIPE when attempting to write to an incoming > connection's socket. Presumably, the client closed the connection in ... > The question: if the client closed the socket, shouldn't a write(2) > return -1 with errno == EPIPE before sending a SIGPIPE? Does anyone well, what would "before" mean ? the system sends a signal when the error is detected, not after an arbitrary amount of time to give the user a chance of handling the return from the syscall. Sounds like the correct approach is to set the handler for SIGPIPE to sig_ign Maybe one should wonder why this is not just the default given that you can get this signal not because your program did something wrong, but because the other end did. cheers luigi To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message