[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: linux has added "close on exec" flags to lots of fd calls
On Mon, 4 Aug 2008 20:39:33 +0100
Love H__rnquist __strand <lha%kth.se@localhost> wrote:
> >> Seems easier just to do open with the additional flag.
> > Not if you want to write portable software.
> This is how you write portable code.
> #ifndef F_CLOEXEC
> #define F_CLOEXEC 0
Any time you have #ifdef for portability, you're in trouble -- it's
hard to test both branches well, and if you have multiple #ifdef
conditions you'll very rarely get it right. I don't think I'd use the
word "portable" for this coding style -- "adaptive", I think, is a
--Steve Bellovin, http://www.cs.columbia.edu/~smb
Main Index |
Thread Index |