Skip to content

Commit

Permalink
tools/lguest: Don't bork the terminal in case of wrong args
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Daniel Baluta authored and Ingo Molnar committed Sep 8, 2016
1 parent cc2187a commit db91e23
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tools/lguest/lguest.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit db91e23

Please sign in to comment.