From 983085923ae1d45196868b48f576b1a19e03e72b Mon Sep 17 00:00:00 2001 From: Herbert Xu Date: Sat, 19 May 2018 02:39:40 +0800 Subject: mkinit: Split reset into exitreset and reset Previously reset was called after exitshell. This was changed so that it was called before exitshell because certain state needed to be reset in order for the EXIT trap to work. However, this caused issues because certain other states (such as local variables) should not be reset. This patch fixes this by creating a new function exitreset that is called prior to exitshell and moving reset back to its original location. Signed-off-by: Herbert Xu --- src/mkinit.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/mkinit.c') diff --git a/src/mkinit.c b/src/mkinit.c index 9714bee..5bca9ee 100644 --- a/src/mkinit.c +++ b/src/mkinit.c @@ -106,6 +106,13 @@ char init[] = "\ * Initialization code.\n\ */\n"; +char exitreset[] = "\ +/*\n\ + * This routine is called when an error or an interrupt occurs in an\n\ + * interactive shell and control is returned to the main command loop\n\ + * but prior to exitshell. \n\ + */\n"; + char reset[] = "\ /*\n\ * This routine is called when an error or an interrupt occurs in an\n\ @@ -115,6 +122,7 @@ char reset[] = "\ struct event event[] = { {"INIT", "init", init}, + {"EXITRESET", "exitreset", exitreset}, {"RESET", "reset", reset}, {NULL, NULL} }; -- cgit 1.4.1