diff options
author | Daniel Baluta <[email protected]> | 2016-09-07 19:49:34 +0930 |
---|---|---|
committer | Ingo Molnar <[email protected]> | 2016-09-08 08:05:24 +0200 |
commit | db91e2370e087967cb6b6425c092188767fb5e00 (patch) | |
tree | 060de0066cd9309329bf716478d6dc2d2c994390 | |
parent | cc2187a6e037bc64404f63c6d650ff263c2200c0 (diff) |
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.
Signed-off-by: Daniel Baluta <[email protected]>
Signed-off-by: Rusty Russell <[email protected]>
Cc: Andy Lutomirski <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Brian Gerst <[email protected]>
Cc: Denys Vlasenko <[email protected]>
Cc: H. Peter Anvin <[email protected]>
Cc: Josh Poimboeuf <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
-rw-r--r-- | tools/lguest/lguest.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/lguest/lguest.c b/tools/lguest/lguest.c index d9836c5eb694..11c8d9bc762e 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(); @@ -3369,9 +3372,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) |