tech-toolchain archive

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

Re: [PATCH] make: Use macro FD_CLOEXEC instead of its raw value



On Sun, Jan 17, 2016 at 01:29:54PM +0100, Tilman Sauerbeck wrote:
> Hi,
> find attached a patch for usr.bin/make that makes it use the constant
> FD_CLOEXEC instead of just passing its value 1 to fcntl().
> 
> I guess we can expect that our build platforms have FD_CLOEXEC these
> days, right? Otherwise we can define FD_CLOEXEC ourselves (make.h?) if
> it's missing.

If the build platform doesn't define FD_CLOEXEC you can't assume it us 1.
Additionally the code ought to be using F_GETFD to ensure it dorsn't
clear any other flags.

Not that I'm currently in a position to fix the code.

>      /* Set close-on-exec flag for both */
> -    (void)fcntl(job->jobPipe[0], F_SETFD, 1);
> -    (void)fcntl(job->jobPipe[1], F_SETFD, 1);
> +    (void)fcntl(job->jobPipe[0], F_SETFD, FD_CLOEXEC);
> +    (void)fcntl(job->jobPipe[1], F_SETFD, FD_CLOEXEC);

	David

-- 
David Laight: david%l8s.co.uk@localhost


Home | Main Index | Thread Index | Old Index