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

According to Bruno Haible on 8/22/2009 5:20 PM:
> Here is a proposal to add a module 'mkostemp', using the source code changes
> from glibc. It also reduces the diffs to glibc, by incorporating parts of this
> glibc commit:

Nice to do some resyncing.  Overall, I'm in favor of this improvement.

> 
> /* Generate a unique temporary file name from TEMPLATE.
>    The last six characters of TEMPLATE must be "XXXXXX";
>    they are replaced with a string that makes the file name unique.
>    Then open the file and return a fd. */
> int
> mkostemp (template, flags)
>      char *template;
>      int flags;

I take it the failure to mention 'flags' in the comment is a glibc oversight?

> +#if @GNULIB_MKOSTEMP@
> +# if !...@have_mkostemp@
> +/* Create a unique temporary file from TEMPLATE.
> +   The last six characters of TEMPLATE must be "XXXXXX";
> +   they are replaced with a string that makes the file name unique.
> +   The file is then created, with the specified flags, ensuring it didn't 
> exist
> +   before.

Should we mention which FLAGS are portable in the gnulib version
(O_CLOEXEC, O_BINARY, O_TEXT), as you did for accept4?

> -       fd = large_open (tmpl, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
> +       fd = __open (tmpl,
> +                    (flags & ~0777) | O_RDWR | O_CREAT | O_EXCL,
> +                    S_IRUSR | S_IWUSR);

Wow - that means any other flags larger than 9  bits, like the sticky bits
at 07000, or even implementation-specific O_* values, are blindly passed
through.  Do we really want that?

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

Eric Blake             e...@byu.net
-----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/

iEYEARECAAYFAkqQr38ACgkQ84KuGfSFAYDEzwCfZr8IvFfks9/2T/jrJw6lLqVv
5iMAoIQzPdddj3FfAYpjMNR42LiTKd6O
=7wXs
-----END PGP SIGNATURE-----


Reply via email to