[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCHv2 0/7] Re: temp file suffixes: mktemp DWIM
From: |
Jim Meyering |
Subject: |
Re: [PATCHv2 0/7] Re: temp file suffixes: mktemp DWIM |
Date: |
Thu, 05 Nov 2009 18:16:19 +0100 |
Eric Blake wrote:
> Eric Blake <ebb9 <at> byu.net> writes:
>
>> On the other hand, aren't there situations with NFS where fflush() will
> succeed
>> at getting the data into a kernel buffer, but fclose() then fails because the
>> kernel was unable to flush its buffers over the network? Maybe we have to do
>> something like dd, where we keep this location calling close_stream after
> all,
>> then use a custom atexit() hook that decides whether to call close_stdout()
> or
>> just manually handle only stderr?
...
> Subject: [PATCH] mktemp: use more robust means to avoid double-close of stdout
>
> * src/mktemp.c (close_stdout_required): New variable.
> (maybe_close_stdout): New function, borrowed from dd.c.
> (main): Track whether stdout has been closed.
...
> +/* True if we need to close standard output. */
> +static bool close_stdout_required = true;
> +
> +/* Avoid closing stdout twice. Since we conditionally call
> + close_stream (stdout) in order to clean up a temporary file, the
> + exit hook needs to decide whether to do all of close_stdout or just
> + the stderr half. */
> Like this. Should I apply it, or is it overkill?
That's better, indeed.
Correctness is never "overkill" ;-)
Yes, please.
- Re: temp file suffixes: mktemp DWIM, (continued)
- Re: temp file suffixes: mktemp DWIM, Jim Meyering, 2009/11/04
- [PATCHv2 0/7] Re: temp file suffixes: mktemp DWIM, Eric Blake, 2009/11/04
- Re: [PATCHv2 0/7] Re: temp file suffixes: mktemp DWIM, Eric Blake, 2009/11/04
- Re: [PATCHv2 0/7] Re: temp file suffixes: mktemp DWIM, Jim Meyering, 2009/11/05
- Re: [PATCHv2 0/7] Re: temp file suffixes: mktemp DWIM, Eric Blake, 2009/11/05
- Re: [PATCHv2 0/7] Re: temp file suffixes: mktemp DWIM, Jim Meyering, 2009/11/05
- Re: [PATCHv2 0/7] Re: temp file suffixes: mktemp DWIM, Jim Meyering, 2009/11/05
- Re: [PATCHv2 0/7] Re: temp file suffixes: mktemp DWIM, Jim Meyering, 2009/11/05
- Re: [PATCHv2 0/7] Re: temp file suffixes: mktemp DWIM, Eric Blake, 2009/11/05
- Re: [PATCHv2 0/7] Re: temp file suffixes: mktemp DWIM, Eric Blake, 2009/11/05
- Re: [PATCHv2 0/7] Re: temp file suffixes: mktemp DWIM,
Jim Meyering <=
- Re: [PATCHv2 0/7] Re: temp file suffixes: mktemp DWIM, Jim Meyering, 2009/11/05
- Re: [PATCHv2 0/7] Re: temp file suffixes: mktemp DWIM, Eric Blake, 2009/11/05
- Re: [PATCHv2 0/7] Re: temp file suffixes: mktemp DWIM, Eric Blake, 2009/11/05
- Re: temp file suffixes: mktemp DWIM, Pádraig Brady, 2009/11/04
Re: temp file suffixes: mktemp DWIM, Eric Blake, 2009/11/03