Skip to contentSkip to conversation

tools/lguest: Don't bork the terminal in case of wrong args

PATCH In review Daniel Baluta 2 participants 3 messages Dec 8, 2015 – Sep 7, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools/lguest: Don't bork the terminal in case of wrong args

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.

---
 tools/lguest/lguest.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
tools/lguest/lguest.c +3 -3
index 80159e6..b7b9c6f 100644
@@ -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)
Signature · 1 line
1.9.1
#1 lore raw
Quoted 5 lines · 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.

Hi Rusty,

Any chance to pick this up?

#2 lore raw
Quoted 10 lines · Daniel Baluta
Quoted 5 lines · 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.

Hi Rusty,

Any chance to pick this up?

Oops! Well re-send to the x86 tree....

Thanks!
Rusty.