Source-Changes-D archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: CVS commit: src/lib/libc
On Sun, Oct 16, 2011 at 01:23:38AM -0400, Christos Zoulas wrote:
...
> | > close on exec fixes:
> | > - open + fcntl -> open O_CLOEXEC
...
> Thanks, but then shouldn't we also add:
>
> #if O_CLOEXEC == 0
> (void)fcntl(sp->fts_rfd, F_SETFD, FD_CLOEXEC);
> #endif
>
> after the open?
In which case it would be cleaner to have something like:
#if define(O_CLOEXEC) && O_CLOEXEC != 0
#define open_cloexec(name, mode) open(name, (mode) | O_CLOEXEC)
#else
static inline int
open_cloexec(const char *name, unsigned int mode)
{
int fd = open(name, mode);
if (fd >= 0)
fcntl(fd, F_SETFD, 0);
return fd;
}
#endif
and the use open_clowxec() in the code.
David
--
David Laight: david%l8s.co.uk@localhost
Home |
Main Index |
Thread Index |
Old Index