From a57b5f44dbc0f494639da67cf7acf8e156d6921f Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Tue, 18 Jun 2019 21:16:32 -0700 Subject: Removed all the /dev/tty redirection and just dup2()'d it before exec()ing the user scripts --- bb.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'bb.c') diff --git a/bb.c b/bb.c index 47a4bbf..a2dd99f 100644 --- a/bb.c +++ b/bb.c @@ -291,6 +291,11 @@ int run_script(bb_t *bb, const char *cmd) setenv("BBDOTFILES", bb->show_dotfiles ? "1" : "", 1); setenv("BBCURSOR", bb->nfiles ? bb->files[bb->cursor]->fullname : "", 1); + int ttyout, ttyin; + ttyout = open("/dev/tty", O_RDWR); + ttyin = open("/dev/tty", O_RDONLY); + dup2(ttyout, STDOUT_FILENO); + dup2(ttyin, STDIN_FILENO); execvp("sh", args); err("Failed to execute command: '%s'", cmd); return -1; -- cgit v1.2.3