ktest: Cleanup terminal on dodie() failure
If dodie() is called with the console open, restore the terminal's
original settings before dying.
Link: http://lkml.kernel.org/r/20150130025453.GB20952@treble.redhat.com
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
index ca20ce2d..840803b 100755
--- a/tools/testing/ktest/ktest.pl
+++ b/tools/testing/ktest/ktest.pl
@@ -1407,6 +1407,11 @@
print " See $opt{LOG_FILE} for more info.\n";
}
+ if ($monitor_cnt) {
+ # restore terminal settings
+ system("stty $stty_orig");
+ }
+
die @_, "\n";
}
@@ -1449,7 +1454,7 @@
close($pts);
exec $console or
- dodie "Can't open console $console";
+ die "Can't open console $console";
}
sub open_console {