Subject: Re: bug#9762: tac fails when given multiple non-seekable inputs due to misuse of mkstemp()

From: Jim Meyering <[email-masked]>
Date: Mon, 17 Oct 2011 17:55:06 +0200

Jim Meyering wrote:
...
>>     maint: tac: remove sole use of sprintf in favor of stpcpy
> ...
>
> I realized that this part of the first patch wasn't quite right...
>
>> Subject: [PATCH 1/3] maint: tac: remove sole use of sprintf in favor of
>>  stpcpy
...
>>    /* FIXME: there's a small window between a successful mkstemp call
>
> Rather than hard-coding the "/", computing lengths, and using separate
> xmalloc and 3 stpcpy calls, I prefer to use file_name_concat:
>
>>>From 54eab68b8c50f93484194090cdc1f079af5533b6 Mon Sep 17 00:00:00 2001
> From: Jim Meyering <[email-masked]>
> Date: Sun, 16 Oct 2011 10:35:56 +0200
> Subject: [PATCH 1/3] maint: tac: remove sole use of sprintf in favor of
>  filenamecat
>
> * src/tac.c: Include filenamecat.h.
> (copy_to_temp): Use filenamecat rather than xmalloc and sprintf.
> Move some declarations "down" to point of initialization.
> ---
>  src/tac.c |   16 ++++++----------
>  1 files changed, 6 insertions(+), 10 deletions(-)
>
> diff --git a/src/tac.c b/src/tac.c
> index 65ac6a6..95a5df7 100644
> --- a/src/tac.c
> +++ b/src/tac.c
> @@ -49,6 +49,7 @@ tac -r -s '.\|
>  #include "safe-read.h"
>  #include "stdlib--.h"
>  #include "xfreopen.h"
> +#include "filenamecat.h"

And I nearly left it that way.
Tweaked to insert the new include in alphabetical order
like all of the others, and pushed.