[PATCH] main: Fix profiling on longjmp exit paths

Herbert Xu <[email protected]>
Newsgroups org.kernel.vger.dash
Message-ID <[email protected]>
Ensure that longjmp exit paths also write the profiling file.

Signed-off-by: Herbert Xu <[email protected]>
---
 src/main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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
-- 
2.39.2

-- 
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.