ash: "Undo all redirections" comment is wrong, delete it
No code changes. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
008fc9499a
commit
170f93ef1b
48
shell/ash.c
48
shell/ash.c
@ -5558,6 +5558,28 @@ redirect(union node *redir, int flags)
|
|||||||
preverrout_fd = copied_fd2;
|
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.
|
* Undo the effects of the last redirection.
|
||||||
*/
|
*/
|
||||||
@ -5593,32 +5615,6 @@ popredir(int drop, int restore)
|
|||||||
INT_ON;
|
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
|
/* ============ Routines to expand arguments to commands
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user