Re: [PATCH] redir: savefd: use F_DUPFD_CLOEXEC instead of F_DUPFD+F_SETFD

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

 



On Sat, Dec 17, 2022 at 12:01:09AM +0100, наб wrote:
> [use F_DUPFD_CLOEXEC instead of F_DUPFD+F_SETFD]
> This saves a syscall on every source file open, &c.;
> F_DUPFD_CLOEXEC is a mandatory part of POSIX since Issue 7
> (Austin Group Interpretation 1003.1-2001 #171).

This is a small optimization and simplification if all target platforms
support F_DUPFD_CLOEXEC, but it may not be worth it if this code is
supposed to work on older platforms. In the mailing list archives, there
are various patches (some applied) to make dash work on old platforms.

Often, the newer _CLOEXEC interfaces are used to avoid race conditions,
but not here, which might confuse porters that the necessary changes are
more complicated than they need to be.

-- 
Jilles Tjoelker



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux