* cons.handler.c (handle_console): Check the result of ttyname().

This commit is contained in:
Pavel Roskin 2001-01-27 07:08:05 +00:00
parent 75b84a3b47
commit 0c940743b3
2 changed files with 8 additions and 4 deletions

View File

@ -1,5 +1,7 @@
2001-01-27 Pavel Roskin <proski@gnu.org>
* cons.handler.c (handle_console): Check the result of ttyname().
* main.c (handle_args): Exit if no arguments are given to mcview.
[HAVE_GNOME]: Don't examine argv[0] - it's done separately.

View File

@ -146,10 +146,12 @@ void handle_console (unsigned char action)
/* Bind standard error to /dev/null */
close (2);
open ("/dev/null", O_WRONLY);
/* Exec the console save/restore handler */
mc_conssaver = concat_dir_and_file (mc_home, "bin/cons.saver");
execl (mc_conssaver, "cons.saver", tty_name, NULL);
/* Exec failed */
if (tty_name) {
/* Exec the console save/restore handler */
mc_conssaver = concat_dir_and_file (mc_home, "bin/cons.saver");
execl (mc_conssaver, "cons.saver", tty_name, NULL);
}
/* Console is not a tty or execl() failed */
console_flag = 0;
write (1, &console_flag, 1);
close (1);