From f613f9573f044220453069ee81ed8706c6e18225 Mon Sep 17 00:00:00 2001 From: Herbert Xu Date: Sun, 19 Jan 2020 18:21:59 +0800 Subject: redir: Clear saved redirections in subshell When we enter a subshell we need to drop the saved redirections as otherwise a subsequent unwindredir could produce incorrect results. This patch does this by simply clearing redirlist. While we could actually free the memory underneath for subshells it isn't really worth the trouble for now. In order to ensure that this is done in every place where we enter a subshell, this patch adds a new mkinit hook called forkreset. The calls closescript, clear_traps and reset_handler are also added to the forkreset hook. This fixes a bug where the first two functions weren't called if we enter a subshell without forking. Reported-by: Harald van Dijk Signed-off-by: Herbert Xu --- src/mkinit.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/mkinit.c') diff --git a/src/mkinit.c b/src/mkinit.c index 5bca9ee..9025862 100644 --- a/src/mkinit.c +++ b/src/mkinit.c @@ -113,6 +113,11 @@ char exitreset[] = "\ * but prior to exitshell. \n\ */\n"; +char forkreset[] = "\ +/*\n\ + * This routine is called when we enter a subshell.\n\ + */\n"; + char reset[] = "\ /*\n\ * This routine is called when an error or an interrupt occurs in an\n\ @@ -123,6 +128,7 @@ char reset[] = "\ struct event event[] = { {"INIT", "init", init}, {"EXITRESET", "exitreset", exitreset}, + {"FORKRESET", "forkreset", forkreset}, {"RESET", "reset", reset}, {NULL, NULL} }; -- cgit 1.4.1 '>diff
Commit message (Expand)Author
2020-02-10Factor out XDG base directory codeJune McEnroe
2020-02-10Leave a blank line after loaded bufferJune McEnroe
2020-02-10Add -s to save and load buffersJune McEnroe
2020-02-10Show heat and other unread in titleJune McEnroe
2020-02-10Eliminate array in hashJune McEnroe
2020-02-10Add -HJune McEnroe
2020-02-10Hash to colors in the range 2-75June McEnroe
2020-02-10Improve color fudgingJune McEnroe
2020-02-10Support all 99 IRC colorsJune McEnroe
2020-02-10Avoid coloring mentions if there are control codesJune McEnroe
2020-02-10Recalculate unreadLines on reflowJune McEnroe
2020-02-10Only make windows hotterJune McEnroe
2020-02-10Always increase unreadLinesJune McEnroe
2020-02-10Move scroll marker on resizeJune McEnroe
2020-02-10Update line count for words longer than linesJune McEnroe
2020-02-10Simplify mark, heat, unread trackingJune McEnroe
2020-02-10Update prompt when own nick changesJune McEnroe
2020-02-10Match URLs surrounded by parenthesesJune McEnroe
2020-02-10Fix M-a so it properly cycles back to where it startedJune McEnroe
2020-02-09Add M-lJune McEnroe
2020-02-09Add /whoisJune McEnroe
2020-02-09Add /msgJune McEnroe