bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] open: introduce O_NOSTD


From: Florian Weimer
Subject: Re: [PATCH] open: introduce O_NOSTD
Date: Fri, 28 Aug 2009 12:52:57 +0000

* Eric Blake:

> Your version fails to clear the cloexec bit of the final fd if the
> original caller didn't request O_CLOEXEC.

Okay, but you can fix that in a race-free manner (but I thought that
this was implied by open_safer).

> If the caller requested O_CLOEXEC, then your version takes 3, 5, or
> 7 syscalls depending on how many std fds were closed, while my
> version takes 3 syscalls regardless of how many std fds were closed.

I really don't see a way around that.  You can't pick a descriptor and
hope that it's unused.

> Also, your suggestion has a definite race in that you are calling
> open() multiple times rather than cloning an existing fd after the
> first open(), such that another process could alter which file is
> visited between your first and last open().

Sure, but this is an unobservable differen.ce

-- 
Florian Weimer                <address@hidden>
BFK edv-consulting GmbH       http://www.bfk.de/
Kriegsstraße 100              tel: +49-721-96201-1
D-76133 Karlsruhe             fax: +49-721-96201-99




reply via email to

[Prev in Thread] Current Thread [Next in Thread]