From owner-freebsd-hackers@FreeBSD.ORG Tue Jun 8 13:13:50 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E012A1065677 for ; Tue, 8 Jun 2010 13:13:50 +0000 (UTC) (envelope-from tss@iki.fi) Received: from dovecot.org (dovecot.org [82.118.211.50]) by mx1.freebsd.org (Postfix) with ESMTP id 9FBF28FC16 for ; Tue, 8 Jun 2010 13:13:50 +0000 (UTC) Received: from [10.134.134.32] (pickles.tp.telepac.pt [194.65.5.228]) by dovecot.org (Postfix) with ESMTP id 1E8ABFA89B4 for ; Tue, 8 Jun 2010 15:51:49 +0300 (EEST) From: Timo Sirainen To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset="UTF-8" Date: Tue, 08 Jun 2010 13:51:47 +0100 Message-ID: <1276001507.6691.388.camel@kurkku.sapo.corppt.com> Mime-Version: 1.0 X-Mailer: Evolution 2.28.3 Content-Transfer-Encoding: 7bit Subject: close() failing with ECONNRESET X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Jun 2010 13:13:51 -0000 I see that since FreeBSD 6.3 close() can fail with: > [ECONNRESET] The underlying object was a stream socket that was > shut down by the peer before all pending data was > delivered. Could someone explain what this is useful for? I'm not aware of any other OS that does this. Is this really something that many programs care about? I'd think there are only very few, and those exceptions could use some other syscall before close() to find out about it. Instead now you're forcing everyone else to change their code from: if (close(fd) < 0) log(..); to if (close(fd) < 0 && errno != ECONNRESET) log(..); or to write some wrapper to close().