On 04/27/2011 07:32 AM, Reuben Thomas wrote:
> On 27 April 2011 14:00, Eric Blake <ebl...@redhat.com> 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 <r...@sc3d.org>
> 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   ebl...@redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to