bug-bash
[Top][All Lists]
Advanced

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

Re: {varname} redirection for a command or group leaves the file open


From: Eduardo Bustamante
Subject: Re: {varname} redirection for a command or group leaves the file open
Date: Sun, 21 May 2017 10:47:37 -0500

FWIW, this seems to "fix" the issue.

address@hidden:~/src/gnu/bash$ git diff -- redir.c
diff --git a/redir.c b/redir.c
index 68741dbb..8113ae3b 100644
--- a/redir.c
+++ b/redir.c
@@ -906,6 +906,7 @@ do_redirection_internal (redirect, flags)
                  close (fd);
                  return (r);   /* XXX */
                }
+             add_undo_close_redirect (redirector);
            }
          else if ((fd != redirector) && (dup2 (fd, redirector) < 0))
            {
@@ -1006,6 +1007,7 @@ do_redirection_internal (redirect, flags)
                      close (fd);
                      return (r);       /* XXX */
                    }
+                 add_undo_close_redirect (redirector);
                }
              else if (fd != redirector && dup2 (fd, redirector) < 0)
                {
@@ -1077,6 +1079,7 @@ do_redirection_internal (redirect, flags)
                  close (redirector);
                  return (r);   /* XXX */
                }
+             add_undo_close_redirect (redirector);
            }
          /* This is correct.  2>&1 means dup2 (1, 2); */
          else if (dup2 (redir_fd, redirector) < 0)



reply via email to

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