summaryrefslogtreecommitdiffstats
path: root/SOURCES/bash-3.0-nfs_redir.patch
diff options
context:
space:
mode:
authorPete Travis <immanetize@fedoraproject.org>2014-10-01 11:54:54 -0600
committerPete Travis <immanetize@fedoraproject.org>2014-10-01 11:54:54 -0600
commitb7fb238e0ec327db793aefa670ffedb8cbd63f0b (patch)
treed795a1fa84fedd491d912cd97c26d80ec523c1fa /SOURCES/bash-3.0-nfs_redir.patch
parent08b01b8f3f227bda87ee2591c7e6ccb379fad187 (diff)
downloadrpmbuild-sles11.1-bash.tar.gz
rpmbuild-sles11.1-bash.tar.xz
rpmbuild-sles11.1-bash.zip
starting bash bracnch for sles 11.1sles11.1-bash
Diffstat (limited to 'SOURCES/bash-3.0-nfs_redir.patch')
-rw-r--r--SOURCES/bash-3.0-nfs_redir.patch148
1 files changed, 148 insertions, 0 deletions
diff --git a/SOURCES/bash-3.0-nfs_redir.patch b/SOURCES/bash-3.0-nfs_redir.patch
new file mode 100644
index 0000000..ac245c9
--- /dev/null
+++ b/SOURCES/bash-3.0-nfs_redir.patch
@@ -0,0 +1,148 @@
+--- redir.c
++++ redir.c 2005-01-28 15:22:21.950230271 +0100
+@@ -169,12 +169,13 @@
+ how to undo the redirections later, if non-zero. If flags & RX_CLEXEC
+ is non-zero, file descriptors opened in do_redirection () have their
+ close-on-exec flag set. */
++static int close_before_dup2_err;
+ int
+ do_redirections (list, flags)
+ REDIRECT *list;
+ int flags;
+ {
+- int error;
++ int error, ret = 0;
+ REDIRECT *temp;
+
+ if (flags & RX_UNDOABLE)
+@@ -190,14 +191,21 @@
+
+ for (temp = list; temp; temp = temp->next)
+ {
++ close_before_dup2_err = 0;
+ error = do_redirection_internal (temp, flags);
+ if (error)
+ {
+ redirection_error (temp, error);
+ return (error);
+ }
++ if (close_before_dup2_err)
++ {
++ redirection_error (temp, close_before_dup2_err);
++ ret = close_before_dup2_err;
++ }
+ }
+- return (0);
++
++ return (ret);
+ }
+
+ /* Return non-zero if the redirection pointed to by REDIRECT has a
+@@ -759,6 +767,8 @@
+ #if defined (BUFFERED_INPUT)
+ check_bash_input (redirector);
+ #endif
++ if ((fd != redirector) && (close(redirector) < 0) && (errno != EBADF))
++ close_before_dup2_err = errno;
+
+ if ((fd != redirector) && (dup2 (fd, redirector) < 0))
+ return (errno);
+@@ -838,6 +848,9 @@
+ #if defined (BUFFERED_INPUT)
+ check_bash_input (redirector);
+ #endif
++ if ((fd != redirector) && (close(redirector) < 0) && (errno != EBADF))
++ close_before_dup2_err = errno;
++
+ if (fd != redirector && dup2 (fd, redirector) < 0)
+ {
+ r = errno;
+@@ -880,6 +893,9 @@
+ #if defined (BUFFERED_INPUT)
+ check_bash_input (redirector);
+ #endif
++ if ((close(redirector) < 0) && (errno != EBADF))
++ close_before_dup2_err = errno;
++
+ /* This is correct. 2>&1 means dup2 (1, 2); */
+ if (dup2 (redir_fd, redirector) < 0)
+ return (errno);
+--- execute_cmd.c
++++ execute_cmd.c 2005-01-28 16:09:10.383937390 +0100
+@@ -119,7 +119,7 @@
+ static void do_piping __P((int, int));
+ static void bind_lastarg __P((char *));
+ static int shell_control_structure __P((enum command_type));
+-static void cleanup_redirects __P((REDIRECT *));
++static int cleanup_redirects __P((REDIRECT *));
+
+ #if defined (JOB_CONTROL)
+ static int restore_signal_mask __P((sigset_t *));
+@@ -393,12 +393,13 @@
+
+ /* A function to use to unwind_protect the redirection undo list
+ for loops. */
+-static void
++static int
+ cleanup_redirects (list)
+ REDIRECT *list;
+ {
+- do_redirections (list, RX_ACTIVE);
++ int ret = do_redirections (list, RX_ACTIVE);
+ dispose_redirects (list);
++ return (ret ? 1 : 0);
+ }
+
+ #if 0
+@@ -603,7 +604,7 @@
+ redirection.) */
+ if (do_redirections (command->redirects, RX_ACTIVE|RX_UNDOABLE) != 0)
+ {
+- cleanup_redirects (redirection_undo_list);
++ (void)cleanup_redirects (redirection_undo_list);
+ redirection_undo_list = (REDIRECT *)NULL;
+ dispose_exec_redirects ();
+ return (EXECUTION_FAILURE);
+@@ -2593,7 +2594,7 @@
+ int pipe_in, pipe_out, async;
+ pid_t old_last_command_subst_pid;
+ {
+- int r;
++ int r, s;
+
+ if (pipe_in != NO_PIPE || pipe_out != NO_PIPE || async)
+ {
+@@ -2632,10 +2633,10 @@
+ substitution. Otherwise, return EXECUTION_SUCCESS. */
+
+ r = do_redirections (redirects, RX_ACTIVE|RX_UNDOABLE);
+- cleanup_redirects (redirection_undo_list);
++ s = cleanup_redirects (redirection_undo_list);
+ redirection_undo_list = (REDIRECT *)NULL;
+
+- if (r != 0)
++ if (r != 0 || s != 0)
+ return (EXECUTION_FAILURE);
+ else if (old_last_command_subst_pid != last_command_subst_pid)
+ return (last_command_exit_value);
+@@ -3404,7 +3405,7 @@
+
+ if (do_redirections (redirects, RX_ACTIVE|RX_UNDOABLE) != 0)
+ {
+- cleanup_redirects (redirection_undo_list);
++ (void)cleanup_redirects (redirection_undo_list);
+ redirection_undo_list = (REDIRECT *)NULL;
+ dispose_exec_redirects ();
+ return (EX_REDIRFAIL); /* was EXECUTION_FAILURE */
+@@ -3463,8 +3464,10 @@
+
+ if (redirection_undo_list)
+ {
+- cleanup_redirects (redirection_undo_list);
++ int ret = cleanup_redirects (redirection_undo_list);
+ redirection_undo_list = (REDIRECT *)NULL;
++ if (result == 0)
++ result = ret;
+ }
+
+ return (result);