bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: sed 4.2.2 does not operate on streams when --follow-symlinks is pass


From: Paolo Bonzini
Subject: Re: sed 4.2.2 does not operate on streams when --follow-symlinks is passed
Date: Thu, 10 Jan 2013 16:12:59 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0

Il 09/01/2013 06:50, Luke T. Shumaker ha scritto:
> sed 4.2.2 introduced the change from 4.2.1 that the
> `--follow-symlinks` option breaks sed's ability to operate on
> streams.
> 
> This option is clearly non-applicable in the situation of editing a
> stream, but should not break in that situation.

This patch should fix it:

diff --git a/sed/execute.c b/sed/execute.c
index cb84192..bce6b6c 100644
--- a/sed/execute.c
+++ b/sed/execute.c
@@ -580,6 +580,7 @@ open_next_file(name, input)
 {
   buffer.length = 0;
 
+  input->in_file_name = name;
   if (name[0] == '-' && name[1] == '\0' && !in_place_extension)
     {
       clearerr(stdin); /* clear any stale EOF indication */
@@ -597,14 +598,11 @@ open_next_file(name, input)
       ++input->bad_count;
       return;
     }
+  else if (follow_symlinks)
+    input->in_file_name = follow_symlink (name);
 
   input->read_fn = read_file_line;
 
-  if (follow_symlinks)
-    input->in_file_name = follow_symlink (name);
-  else
-    input->in_file_name = name;
-
   if (in_place_extension)
     {
       int input_fd;


Paolo



reply via email to

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