aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2017-07-29 18:54:53 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2017-07-29 18:54:53 +0200
commit170f93ef1bc49a9e4c68f85f5245416767c1916f (patch)
tree2aec1175c0c996cf890f84b3848544cf91a0aa1d
parent008fc9499ae63186589fbc81a5f849a2df652004 (diff)
downloadbusybox-w32-170f93ef1bc49a9e4c68f85f5245416767c1916f.tar.gz
busybox-w32-170f93ef1bc49a9e4c68f85f5245416767c1916f.tar.bz2
busybox-w32-170f93ef1bc49a9e4c68f85f5245416767c1916f.zip
ash: "Undo all redirections" comment is wrong, delete it
No code changes. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--shell/ash.c48
1 files changed, 22 insertions, 26 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 0de81b325..02b21510e 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -5558,6 +5558,28 @@ redirect(union node *redir, int flags)
5558 preverrout_fd = copied_fd2; 5558 preverrout_fd = copied_fd2;
5559} 5559}
5560 5560
5561static int
5562redirectsafe(union node *redir, int flags)
5563{
5564 int err;
5565 volatile int saveint;
5566 struct jmploc *volatile savehandler = exception_handler;
5567 struct jmploc jmploc;
5568
5569 SAVE_INT(saveint);
5570 /* "echo 9>/dev/null; echo >&9; echo result: $?" - result should be 1, not 2! */
5571 err = setjmp(jmploc.loc); // huh?? was = setjmp(jmploc.loc) * 2;
5572 if (!err) {
5573 exception_handler = &jmploc;
5574 redirect(redir, flags);
5575 }
5576 exception_handler = savehandler;
5577 if (err && exception_type != EXERROR)
5578 longjmp(exception_handler->loc, 1);
5579 RESTORE_INT(saveint);
5580 return err;
5581}
5582
5561/* 5583/*
5562 * Undo the effects of the last redirection. 5584 * Undo the effects of the last redirection.
5563 */ 5585 */
@@ -5593,32 +5615,6 @@ popredir(int drop, int restore)
5593 INT_ON; 5615 INT_ON;
5594} 5616}
5595 5617
5596/*
5597 * Undo all redirections. Called on error or interrupt.
5598 */
5599
5600static int
5601redirectsafe(union node *redir, int flags)
5602{
5603 int err;
5604 volatile int saveint;
5605 struct jmploc *volatile savehandler = exception_handler;
5606 struct jmploc jmploc;
5607
5608 SAVE_INT(saveint);
5609 /* "echo 9>/dev/null; echo >&9; echo result: $?" - result should be 1, not 2! */
5610 err = setjmp(jmploc.loc); // huh?? was = setjmp(jmploc.loc) * 2;
5611 if (!err) {
5612 exception_handler = &jmploc;
5613 redirect(redir, flags);
5614 }
5615 exception_handler = savehandler;
5616 if (err && exception_type != EXERROR)
5617 longjmp(exception_handler->loc, 1);
5618 RESTORE_INT(saveint);
5619 return err;
5620}
5621
5622 5618
5623/* ============ Routines to expand arguments to commands 5619/* ============ Routines to expand arguments to commands
5624 * 5620 *