Subject: Re: bug#9762: tac fails when given multiple non-seekable inputs due to misuse of mkstemp()
From: Jim Meyering <[email-masked]>
To: Ambrose Feinstein <[email-masked]>
Cc: [email-masked]
Date: Wed, 19 Oct 2011 09:34:39 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Jim Meyering wrote:
> Ambrose Feinstein wrote:
>> Thanks for the quick fix!
>>
>> Aside from it requiring rearranging other code to not close the fd,
>> was there a reason not to reuse a single temp file?
>
> Actually that's what I started doing, but the change seemed like it'd
> end up being bigger than I wanted for a bug fix.  In retrospect, now
> that I've done it and see the extent, it would have been ok.
>
> Especially once I considered another factor: we want to avoid use of
> functions like xmalloc and file_name_concat that call exit upon failure.
> See the log on the second patch below for why.
>
>
>>From fef2bc68e36c8891780311d8869db23753c093d0 Mon Sep 17 00:00:00 2001
> From: Jim Meyering <[email-masked]>
> Date: Tue, 18 Oct 2011 11:44:39 +0200
> Subject: [PATCH 1/3] tac: use only one temporary file, with multiple
>  nonseekable inputs
>
> * src/tac.c (temp_stream): New function, factored out of...
> (copy_to_temp): ...here.
> (tac_nonseekable): Don't free or fclose, now that we reuse the file.

Added this, and pushed:

Suggested by Ambrose Feinstein.
* THANKS.in: Update.

diff --git a/THANKS.in b/THANKS.in
index 23ac679..83a7864 100644
--- a/THANKS.in
+++ b/THANKS.in
@@ -37,6 +37,7 @@ Alexandre Duret-Lutz                [email-masked]
 Alexey Solovyov                     [email-masked]
 Alexey Vyskubov                     [email-masked]
 Alfred M. Szmidt                    [email-masked]
+Ambrose Feinstein                   [email-masked]
 Andi Kleen                          [email-masked]
 Andre Novaes Cunha                  [email-masked]
 Andreas Frische                     [email-masked]