From 170f93ef1bc49a9e4c68f85f5245416767c1916f Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sat, 29 Jul 2017 18:54:53 +0200 Subject: ash: "Undo all redirections" comment is wrong, delete it No code changes. Signed-off-by: Denys Vlasenko --- shell/ash.c | 48 ++++++++++++++++++++++-------------------------- 1 file changed, 22 insertions(+), 26 deletions(-) (limited to 'shell') 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) preverrout_fd = copied_fd2; } +static int +redirectsafe(union node *redir, int flags) +{ + int err; + volatile int saveint; + struct jmploc *volatile savehandler = exception_handler; + struct jmploc jmploc; + + SAVE_INT(saveint); + /* "echo 9>/dev/null; echo >&9; echo result: $?" - result should be 1, not 2! */ + err = setjmp(jmploc.loc); // huh?? was = setjmp(jmploc.loc) * 2; + if (!err) { + exception_handler = &jmploc; + redirect(redir, flags); + } + exception_handler = savehandler; + if (err && exception_type != EXERROR) + longjmp(exception_handler->loc, 1); + RESTORE_INT(saveint); + return err; +} + /* * Undo the effects of the last redirection. */ @@ -5593,32 +5615,6 @@ popredir(int drop, int restore) INT_ON; } -/* - * Undo all redirections. Called on error or interrupt. - */ - -static int -redirectsafe(union node *redir, int flags) -{ - int err; - volatile int saveint; - struct jmploc *volatile savehandler = exception_handler; - struct jmploc jmploc; - - SAVE_INT(saveint); - /* "echo 9>/dev/null; echo >&9; echo result: $?" - result should be 1, not 2! */ - err = setjmp(jmploc.loc); // huh?? was = setjmp(jmploc.loc) * 2; - if (!err) { - exception_handler = &jmploc; - redirect(redir, flags); - } - exception_handler = savehandler; - if (err && exception_type != EXERROR) - longjmp(exception_handler->loc, 1); - RESTORE_INT(saveint); - return err; -} - /* ============ Routines to expand arguments to commands * -- cgit v1.2.3