diff --git a/scp.c b/scp.c index 3ab58051..206ff0ba 100644 --- a/scp.c +++ b/scp.c @@ -7511,22 +7511,26 @@ for (i = 1; (dptr = sim_devices[i]) != NULL; i++) { /* reposition all */ } } if ((r = sim_ttrun ()) != SCPE_OK) { /* set console mode */ + r = sim_messagef (SCPE_TTYERR, "sim_ttrun() returned: %s - errno: %d - %s\n", sim_error_text (r), errno, strerror (errno)); sim_ttcmd (); - return sim_messagef (SCPE_TTYERR, "sim_ttrun() returned: %s\n", sim_error_text (r)); + return r; } if ((r = sim_check_console (30)) != SCPE_OK) { /* check console, error? */ + r = sim_messagef (r, "sim_check_console () returned: %s - errno: %d - %s\n", sim_error_text (r), errno, strerror (errno)); sim_ttcmd (); - sim_messagef (r, "sim_check_console () returned: %s\n", sim_error_text (r)); + return r; } #ifdef SIGHUP if (signal (SIGHUP, int_handler) == SIG_ERR) { /* set WRU */ + r = sim_messagef (SCPE_SIGERR, "Can't establish SIGHUP: errno: %d - %s", errno, strerror (errno)); sim_ttcmd (); - return sim_messagef (SCPE_SIGERR, "Can't establish SIGHUP"); + return r; } #endif if (signal (SIGTERM, int_handler) == SIG_ERR) { /* set WRU */ + r = sim_messagef (SCPE_SIGERR, "Can't establish SIGTERM: errno: %d - %s", errno, strerror (errno)); sim_ttcmd (); - return sim_messagef (SCPE_SIGERR, "Can't establish SIGTERM"); + return r; } stop_cpu = FALSE; sim_is_running = TRUE; /* flag running */ diff --git a/sim_console.c b/sim_console.c index e14786da..fc35d801 100644 --- a/sim_console.c +++ b/sim_console.c @@ -3988,7 +3988,7 @@ runtty.c_cc[VINTR] = 0; /* OS X doesn't deliver #else runtty.c_cc[VINTR] = sim_int_char; /* in case changed */ #endif -if (tcsetattr (0, TCSAFLUSH, &runtty) < 0) +if (tcsetattr (fileno(stdin), TCSAFLUSH, &runtty) < 0) return SCPE_TTIERR; sim_os_set_thread_priority (PRIORITY_BELOW_NORMAL); /* try to lower pri */ return SCPE_OK; @@ -3999,7 +3999,7 @@ static t_stat sim_os_ttcmd (void) if (!isatty (fileno (stdin))) /* skip if !tty */ return SCPE_OK; sim_os_set_thread_priority (PRIORITY_NORMAL); /* try to raise pri */ -if (tcsetattr (0, TCSAFLUSH, &cmdtty) < 0) +if (tcsetattr (fileno(stdin), TCSAFLUSH, &cmdtty) < 0) return SCPE_TTIERR; return SCPE_OK; }