SCP: Fix Coverity identified issues

This commit is contained in:
Mark Pizzolato 2018-09-28 20:47:54 -07:00
parent c640000b54
commit b6b457a84d
2 changed files with 4 additions and 5 deletions

View file

@ -3956,7 +3956,6 @@ static t_stat sim_os_ttinit (void)
sim_debug (DBG_TRC, &sim_con_telnet, "sim_os_ttinit()\n"); sim_debug (DBG_TRC, &sim_con_telnet, "sim_os_ttinit()\n");
cmdfl = fcntl (fileno (stdin), F_GETFL, 0); /* get old flags and status */ cmdfl = fcntl (fileno (stdin), F_GETFL, 0); /* get old flags and status */
runfl = cmdfl;
/* /*
* make sure systems with broken termios (that don't honor * make sure systems with broken termios (that don't honor
* VMIN=0 and VTIME=0) actually implement non blocking reads. * VMIN=0 and VTIME=0) actually implement non blocking reads.
@ -4015,7 +4014,7 @@ sim_debug (DBG_TRC, &sim_con_telnet, "sim_os_ttrun()\n");
if (!isatty (fileno (stdin))) /* skip if !tty */ if (!isatty (fileno (stdin))) /* skip if !tty */
return SCPE_OK; return SCPE_OK;
fcntl (fileno (stdin), F_SETFL, runfl); /* non-block mode */ (void)fcntl (fileno (stdin), F_SETFL, runfl); /* non-block mode */
#if defined(USE_SIM_VIDEO) && defined(HAVE_LIBSDL) #if defined(USE_SIM_VIDEO) && defined(HAVE_LIBSDL)
runtty.c_cc[VINTR] = 0; /* OS X doesn't deliver SIGINT to main thread when enabled */ runtty.c_cc[VINTR] = 0; /* OS X doesn't deliver SIGINT to main thread when enabled */
#else #else
@ -4034,7 +4033,7 @@ sim_debug (DBG_TRC, &sim_con_telnet, "sim_os_ttcmd() - BSDTTY\n");
if (!isatty (fileno (stdin))) /* skip if !tty */ if (!isatty (fileno (stdin))) /* skip if !tty */
return SCPE_OK; return SCPE_OK;
sim_os_set_thread_priority (PRIORITY_NORMAL); /* try to raise pri */ sim_os_set_thread_priority (PRIORITY_NORMAL); /* try to raise pri */
fcntl (0, F_SETFL, cmdfl); /* block mode */ (void)fcntl (0, F_SETFL, cmdfl); /* block mode */
if (tcsetattr (fileno(stdin), TCSETATTR_ACTION, &cmdtty) < 0) if (tcsetattr (fileno(stdin), TCSETATTR_ACTION, &cmdtty) < 0)
return SCPE_TTIERR; return SCPE_TTIERR;
return SCPE_OK; return SCPE_OK;

View file

@ -1204,7 +1204,7 @@ for (i = 0; i < mp->lines; i++) { /* check each line in se
free (sockname); free (sockname);
free (peername); free (peername);
if (!lp->notelnet) { if (!lp->notelnet) {
sim_write_sock (newsock, (char *)mantra, sizeof(mantra)); sim_write_sock (lp->sock, (char *)mantra, sizeof(mantra));
tmxr_debug (TMXR_DBG_XMT, lp, "Sending", (char *)mantra, sizeof(mantra)); tmxr_debug (TMXR_DBG_XMT, lp, "Sending", (char *)mantra, sizeof(mantra));
lp->telnet_sent_opts = (uint8 *)realloc (lp->telnet_sent_opts, 256); lp->telnet_sent_opts = (uint8 *)realloc (lp->telnet_sent_opts, 256);
memset (lp->telnet_sent_opts, 0, 256); memset (lp->telnet_sent_opts, 0, 256);
@ -1255,7 +1255,7 @@ for (i = 0; i < mp->lines; i++) { /* check each line in se
lp->ipad = address; /* ip address */ lp->ipad = address; /* ip address */
tmxr_init_line (lp); /* init line */ tmxr_init_line (lp); /* init line */
if (!lp->notelnet) { if (!lp->notelnet) {
sim_write_sock (newsock, (char *)mantra, sizeof(mantra)); sim_write_sock (lp->sock, (char *)mantra, sizeof(mantra));
tmxr_debug (TMXR_DBG_XMT, lp, "Sending", (char *)mantra, sizeof(mantra)); tmxr_debug (TMXR_DBG_XMT, lp, "Sending", (char *)mantra, sizeof(mantra));
lp->telnet_sent_opts = (uint8 *)realloc (lp->telnet_sent_opts, 256); lp->telnet_sent_opts = (uint8 *)realloc (lp->telnet_sent_opts, 256);
memset (lp->telnet_sent_opts, 0, 256); memset (lp->telnet_sent_opts, 0, 256);