diff mbox series

main: Fix profiling on longjmp exit paths

Message ID ZizBQ4KYRqO4B3Bc@gondor.apana.org.au (mailing list archive)
State Accepted
Delegated to: Herbert Xu
Headers show
Series main: Fix profiling on longjmp exit paths | expand

Commit Message

Herbert Xu April 27, 2024, 9:11 a.m. UTC
Ensure that longjmp exit paths also write the profiling file.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
---
 src/main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/src/main.c b/src/main.c
index 5c49fdc..7beb280 100644
--- a/src/main.c
+++ b/src/main.c
@@ -112,7 +112,7 @@  main(int argc, char **argv)
 
 		s = state;
 		if (e == EXEND || e == EXEXIT || s == 0 || iflag == 0 || shlvl)
-			exitshell();
+			goto exit;
 
 		reset();
 
@@ -175,6 +175,7 @@  state3:
 state4:	/* XXX ??? - why isn't this before the "if" statement */
 		cmdloop(1);
 	}
+exit:
 #if PROFILE
 	monitor(0);
 #endif