Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1286537 > unrolled thread

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

Started byDaniel Baluta <daniel.baluta@intel.com>
First post2015-12-08 15:40 +0100
Last post2015-12-08 15:40 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH] tools/lguest: Don't bork the terminal in case of wrong args Daniel Baluta <daniel.baluta@intel.com> - 2015-12-08 15:40 +0100

#1286537 — [PATCH] tools/lguest: Don't bork the terminal in case of wrong args

FromDaniel Baluta <daniel.baluta@intel.com>
Date2015-12-08 15:40 +0100
Subject[PATCH] tools/lguest: Don't bork the terminal in case of wrong args
Message-ID<qDrAS-3yq-27@gated-at.bofh.it>
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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web