bug-gnulib
[Top][All Lists]
Advanced

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

Re: [PATCH] popen-safer: test O_CLOEXEC at run-time.


From: Eric Blake
Subject: Re: [PATCH] popen-safer: test O_CLOEXEC at run-time.
Date: Fri, 21 Aug 2009 05:57:38 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.22) Gecko/20090605 Thunderbird/2.0.0.22 Mnenhy/0.7.6.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Paolo Bonzini on 8/21/2009 1:42 AM:
> This patch tests for the presence of O_CLOEXEC at run-time.
> 
> The technique I use allows to use only two system calls instead of
> three on system where O_CLOEXEC does not work, at least after the
> first call to open_noinherit.

Sounds good to me, except for a couple of nits:

> +#ifdef O_CLOEXEC
> +  /* 0 = unknown, 1 = yes, -1 = no.  */
> +  static bool have_cloexec;

This has to be an int, not a bool, per the documented semantics you gave it.

> +  if (have_cloexec >= 0)
> +    {
> +      fd = open (name, flags | O_CLOEXEC);
                               ^
Not sure how that 8-bit character got there.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkqOi7IACgkQ84KuGfSFAYBgyACeM7KtVd4iWuXX5XMK0/+Mh1n+
VREAoJLoCuP0DL1ewOBB+TDH1agkYw9B
=VXK4
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]