bug-coreutils
[Top][All Lists]
Advanced

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

bug#25041: Bugs in TAC and TAIL for closed stdin


From: Pádraig Brady
Subject: bug#25041: Bugs in TAC and TAIL for closed stdin
Date: Sun, 27 Nov 2016 21:22:48 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0

On 27/11/16 15:51, Jim Meyering wrote:
> On Sun, Nov 27, 2016 at 7:40 AM, Pádraig Brady <address@hidden> wrote:
>> I'll push the attached later
> 
> Thanks to both of you.
> 
> That patch looks fine, modulo a formatting nit: the second line is
> indented one space too far:
> 
> +              f->ignore = ! (reopen_inaccessible_files
> +                              && follow_mode == Follow_name);
> 

Done.
Also we should probably clear any errors such as ENOSPC
from the stream before reuse for the next input:

diff --git a/src/tac.c b/src/tac.c
index 2e820fa..c1b6003 100644
--- a/src/tac.c
+++ b/src/tac.c
@@ -477,6 +477,7 @@ temp_stream (FILE **fp, char **file_name)
     }
   else
     {
+      clearerr (tmp_fp);
       if (fseeko (tmp_fp, 0, SEEK_SET) < 0
           || ftruncate (fileno (tmp_fp), 0) < 0)
         {

cheers,
Pádraig





reply via email to

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