On Sat, Feb 11, 2012 at 3:15 PM, Ross Lagerwall <rosslagerw...@gmail.com> wrote: > If we can't trust the compile-time value and we can't detect the runtime > behavior then I think the solution I suggested is a reasonable idea.
Agreed. (Actually, we _could_ detect it at runtime by using fcntl(F_GETFD) on an fd after we opened it with O_CLOEXEC. But that would throw away the syscall that we just saved.) >> Additionally, I see 3 other open()s: two in arc4random.c and one in >> devpoll.c. Maybe this means we want an evutil_* wrapper function to >> set CLOEXEC on fds. >> >> thoughts? > > Attached is a patch which provides a new utility function, > evutil_open_closeonexec which is used instead in place of the various > open() calls. Looks good. I'm merging it onto patches-2.0, with a couple of tweaks: * Windows doesn't have mode_t so far as I can tell, so I'm using "unsigned" instead. * I'm not passing the third argument to open unless the O_CREAT flag was provided; I seem to recall that using the three-argument form without O_CREAT can confuse some unixes. cheers, -- Nick *********************************************************************** To unsubscribe, send an e-mail to majord...@freehaven.net with unsubscribe libevent-users in the body.