diff options
Diffstat (limited to 'shell/ash.c')
-rw-r--r-- | shell/ash.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/shell/ash.c b/shell/ash.c index dfe6d1c48..fbe8dd9e4 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -14284,11 +14284,11 @@ read_profile(const char *name) | |||
14284 | 14284 | ||
14285 | /* | 14285 | /* |
14286 | * This routine is called when an error or an interrupt occurs in an | 14286 | * This routine is called when an error or an interrupt occurs in an |
14287 | * interactive shell and control is returned to the main command loop. | 14287 | * interactive shell and control is returned to the main command loop |
14288 | * (In dash, this function is auto-generated by build machinery). | 14288 | * but prior to exitshell. |
14289 | */ | 14289 | */ |
14290 | static void | 14290 | static void |
14291 | reset(void) | 14291 | exitreset(void) |
14292 | { | 14292 | { |
14293 | /* from eval.c: */ | 14293 | /* from eval.c: */ |
14294 | evalskip = 0; | 14294 | evalskip = 0; |
@@ -14301,14 +14301,23 @@ reset(void) | |||
14301 | /* from expand.c: */ | 14301 | /* from expand.c: */ |
14302 | ifsfree(); | 14302 | ifsfree(); |
14303 | 14303 | ||
14304 | /* from redir.c: */ | ||
14305 | unwindredir(NULL); | ||
14306 | } | ||
14307 | |||
14308 | /* | ||
14309 | * This routine is called when an error or an interrupt occurs in an | ||
14310 | * interactive shell and control is returned to the main command loop. | ||
14311 | * (In dash, this function is auto-generated by build machinery). | ||
14312 | */ | ||
14313 | static void | ||
14314 | reset(void) | ||
14315 | { | ||
14304 | /* from input.c: */ | 14316 | /* from input.c: */ |
14305 | g_parsefile->left_in_buffer = 0; | 14317 | g_parsefile->left_in_buffer = 0; |
14306 | g_parsefile->left_in_line = 0; /* clear input buffer */ | 14318 | g_parsefile->left_in_line = 0; /* clear input buffer */ |
14307 | popallfiles(); | 14319 | popallfiles(); |
14308 | 14320 | ||
14309 | /* from redir.c: */ | ||
14310 | unwindredir(NULL); | ||
14311 | |||
14312 | /* from var.c: */ | 14321 | /* from var.c: */ |
14313 | unwindlocalvars(NULL); | 14322 | unwindlocalvars(NULL); |
14314 | } | 14323 | } |
@@ -14356,13 +14365,16 @@ int ash_main(int argc UNUSED_PARAM, char **argv) | |||
14356 | smallint e; | 14365 | smallint e; |
14357 | smallint s; | 14366 | smallint s; |
14358 | 14367 | ||
14359 | reset(); | 14368 | exitreset(); |
14360 | 14369 | ||
14361 | e = exception_type; | 14370 | e = exception_type; |
14362 | s = state; | 14371 | s = state; |
14363 | if (e == EXEXIT || s == 0 || iflag == 0 || shlvl) { | 14372 | if (e == EXEXIT || s == 0 || iflag == 0 || shlvl) { |
14364 | exitshell(); | 14373 | exitshell(); |
14365 | } | 14374 | } |
14375 | |||
14376 | reset(); | ||
14377 | |||
14366 | if (e == EXINT) { | 14378 | if (e == EXINT) { |
14367 | newline_and_flush(stderr); | 14379 | newline_and_flush(stderr); |
14368 | } | 14380 | } |