bug-gnulib
[Top][All Lists]
Advanced

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

Re: mkstemp


From: Eric Blake
Subject: Re: mkstemp
Date: Wed, 27 Apr 2011 08:17:35 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.15) Gecko/20110307 Fedora/3.1.9-0.39.b3pre.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.9

On 04/27/2011 07:32 AM, Reuben Thomas wrote:
> On 27 April 2011 14:00, Eric Blake <address@hidden> wrote:
>> On 04/27/2011 04:05 AM, Reuben Thomas wrote:
>>
>>> However, this suggests that the gnulib documentation for mkstemp
>>> should direct the programmer to clean-temp, something like:
>>>
>>> "If you are creating temporary files which will later be removed, consider
>>> using the clean-temp module, which avoids several pitfalls of using mkstemp
>>> directly."
>>
>> I could also live with that in the mkstemp.c file.  Would you care to
>> help write the patch?
> 
> Patch attached (just to add that comment).

Can you convince your mailer to send patches inline, or at least with
text/plain MIME type?  Also, please remember a changelog entry (you can
reuse the Changelog entry as the git commit message, especially if you
use Jim's vc-dwim tool set).

> commit 2ed565837e21e753443e126f5024d2d9d9fbf449
> Author: Reuben Thomas <address@hidden>
> Date:   Wed Apr 27 14:30:31 2011 +0100
> 
>     Tell mkstemp users to consider using the clean-temp module
>     
>     * lib/mkstemp.c: Add comment.
> 
> diff --git a/lib/mkstemp.c b/lib/mkstemp.c
> index b0a8df3..3c8437e 100644
> --- a/lib/mkstemp.c
> +++ b/lib/mkstemp.c
> @@ -38,7 +38,11 @@
>  /* Generate a unique temporary file name from XTEMPLATE.
>     The last six characters of XTEMPLATE must be "XXXXXX";
>     they are replaced with a string that makes the file name unique.
> -   Then open the file and return a fd. */
> +   Then open the file and return a fd.
> +
> +   If you are creating temporary files which will later be removed,
> +   consider using the clean-temp module, which avoids several pitfalls
> +   of using mkstemp directly. */
>  int
>  mkstemp (char *xtemplate)

Works for me, but I also think doc/posix-functions/mkstemp.texi could
use a similar comment.  I added that, and pushed the modified result.

-- 
Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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