All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tools/lguest: Don't bork the terminal in case of wrong args
@ 2015-12-08 14:35 Daniel Baluta
  2016-09-07  9:00 ` Daniel Baluta
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Baluta @ 2015-12-08 14:35 UTC (permalink / raw)
  To: rusty, lguest; +Cc: linux-kernel, daniel.baluta

Running lguest without arguments or with a wrong argument name
borks the terminal, because the cleanup handler is set up too late
in the initialization process.

Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
---
 tools/lguest/lguest.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/lguest/lguest.c b/tools/lguest/lguest.c
index 80159e6..b7b9c6f 100644
--- a/tools/lguest/lguest.c
+++ b/tools/lguest/lguest.c
@@ -3266,6 +3266,9 @@ int main(int argc, char *argv[])
 		}
 	}
 
+	/* If we exit via err(), this kills all the threads, restores tty. */
+	atexit(cleanup_devices);
+
 	/* We always have a console device, and it's always device 1. */
 	setup_console();
 
@@ -3363,9 +3366,6 @@ int main(int argc, char *argv[])
 	/* Ensure that we terminate if a device-servicing child dies. */
 	signal(SIGCHLD, kill_launcher);
 
-	/* If we exit via err(), this kills all the threads, restores tty. */
-	atexit(cleanup_devices);
-
 	/* If requested, chroot to a directory */
 	if (chroot_path) {
 		if (chroot(chroot_path) != 0)
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-09-07 19:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-08 14:35 [PATCH] tools/lguest: Don't bork the terminal in case of wrong args Daniel Baluta
2016-09-07  9:00 ` Daniel Baluta
2016-09-07 10:18   ` Rusty Russell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.