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 <daniel.baluta@intel.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
Daniel Baluta 2016-09-07 19:49:34 +09:30 committed by Ingo Molnar
parent cc2187a6e0
commit db91e2370e
1 changed files with 3 additions and 3 deletions

View File

@ -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)