From: Rich Felker <dalias@aerifal.cx>
To: musl@lists.openwall.com
Subject: Re: close(2) failure cases (was: some fixes to musl)
Date: Sun, 24 Jul 2011 08:24:02 -0400 [thread overview]
Message-ID: <20110724122402.GH132@brightrain.aerifal.cx> (raw)
In-Reply-To: <20110724091918.GA6076@albatros>
On Sun, Jul 24, 2011 at 01:19:18PM +0400, Vasiliy Kulikov wrote:
> I've looked at some Linux code related to close(). It may fail iff
> file_ops->flush() is not NULL, and close() fails iff ->flush() fails.
Thank you for making the effort to investigate!
> Even if close() fails, the fd is freed. So fd leakage is impossible.
Is this true even in the case of EINTR?
> As musl is Linux specific libc, you're free to rely on Linux specific
> restrictions/features. However, I don't know whether close()
> implementation is guaranteed to be errorless for these types of files.
> If no, it may be changed in the future by introducing some new feature
> (and it will not break POSIX as POSIX explicitly defines close()
> failure possibility). It's very unlikely though, as breaking tons of
> programs relying on implicit Linux behaviour is not encouraged by Linus.
Not only does it break lots of programs; it also makes fixing those
programs impossible. There is simply no way to recovery from failed
resource deallocation. (Think of C++ and RAII...)
Rich
next prev parent reply other threads:[~2011-07-24 12:24 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-21 17:02 some fixes to musl Vasiliy Kulikov
2011-07-21 18:21 ` Rich Felker
2011-07-21 19:00 ` Solar Designer
2011-07-22 8:19 ` Vasiliy Kulikov
2011-07-22 13:30 ` Rich Felker
2011-07-21 19:17 ` Vasiliy Kulikov
2011-07-22 2:08 ` Rich Felker
2011-07-24 9:39 ` Vasiliy Kulikov
2011-07-24 12:56 ` Rich Felker
2011-07-24 18:38 ` Vasiliy Kulikov
2011-07-24 9:19 ` close(2) failure cases (was: some fixes to musl) Vasiliy Kulikov
2011-07-24 12:24 ` Rich Felker [this message]
2011-07-24 17:49 ` Vasiliy Kulikov
2011-07-24 22:29 ` Rich Felker
2011-07-25 17:36 ` Vasiliy Kulikov
2011-07-22 1:57 ` some fixes to musl Rich Felker
2011-07-22 4:30 ` Rich Felker
2011-07-22 8:26 ` Vasiliy Kulikov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110724122402.GH132@brightrain.aerifal.cx \
--to=dalias@aerifal.cx \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).