From owner-freebsd-hackers@freebsd.org Fri Dec 29 23:27:04 2017 Return-Path: Delivered-To: freebsd-hackers@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 B0A9FEB5F25 for ; Fri, 29 Dec 2017 23:27:04 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) by mx1.freebsd.org (Postfix) with ESMTP id 7756F80AC8 for ; Fri, 29 Dec 2017 23:27:03 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from critter.freebsd.dk (unknown [192.168.55.3]) by phk.freebsd.dk (Postfix) with ESMTP id EF98827378; Fri, 29 Dec 2017 23:26:55 +0000 (UTC) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.15.2/8.15.2) with ESMTPS id vBTNQejt048625 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 29 Dec 2017 23:26:40 GMT (envelope-from phk@critter.freebsd.dk) Received: (from phk@localhost) by critter.freebsd.dk (8.15.2/8.15.2/Submit) id vBTNQd8e048624; Fri, 29 Dec 2017 23:26:39 GMT (envelope-from phk) To: Yuri cc: Freebsd hackers list Subject: Re: Is it considered to be ok to not check the return code of close(2) in base? In-reply-to: <24acbd94-c52f-e71a-8a96-d608a10963c6@rawbw.com> From: "Poul-Henning Kamp" References: <24acbd94-c52f-e71a-8a96-d608a10963c6@rawbw.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <48622.1514589999.1@critter.freebsd.dk> Date: Fri, 29 Dec 2017 23:26:39 +0000 Message-ID: <48623.1514589999@critter.freebsd.dk> X-Mailman-Approved-At: Sat, 30 Dec 2017 00:55:59 +0000 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Dec 2017 23:27:04 -0000 -------- In message <24acbd94-c52f-e71a-8a96-d608a10963c6@rawbw.com>, Yuri writes: >Some base utilities sometimes close files that they open for their >purposes without checking the error code of close(2). My personal policy has become to always assert the return value of close(2) calls and to leave the asserts in the production code since they cost nothing in practice. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence.