Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 29 Dec 2017 23:26:39 +0000
From:      "Poul-Henning Kamp" <phk@phk.freebsd.dk>
To:        Yuri <yuri@rawbw.com>
Cc:        Freebsd hackers list <freebsd-hackers@FreeBSD.org>
Subject:   Re: Is it considered to be ok to not check the return code of close(2) in base?
Message-ID:  <48623.1514589999@critter.freebsd.dk>
In-Reply-To: <24acbd94-c52f-e71a-8a96-d608a10963c6@rawbw.com>
References:  <24acbd94-c52f-e71a-8a96-d608a10963c6@rawbw.com>

next in thread | previous in thread | raw e-mail | index | archive | help
--------
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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?48623.1514589999>