AmendHub

Download:

jcs

/

subtext

/

amendments

/

151

serial: Fix sscanf parameter


jcs made amendment 151 over 2 years ago
--- serial.c Mon Jun 13 16:35:14 2022 +++ serial.c Thu Jun 16 21:51:58 2022 @@ -287,13 +287,15 @@ serial_idle(void) long count, i; char *line; +#if 0 SerStatus(serial_in_refnum, &status); if (status.ctsHold != 0) - ;//warn("CTS set"); + session_log(session, "CTS set"); if (status.xOffHold != 0) - warn("xoff set"); + session_log(session, "XOFF set"); if (status.cumErrs != 0) - ;//warn("break!"); + session_log(session, "Reported errors %d", status.cumErrs); +#endif if (the_serial_node.connected) return; @@ -314,7 +316,7 @@ serial_idle(void) the_serial_node.session->vt100 = 1; /* TODO: pass caller id */ - if (sscanf(line, "CONNECT %ld/%n", baud, &count) == 1 && + if (sscanf(line, "CONNECT %ld/%n", &baud, &count) == 1 && count > 0) the_serial_node.session->tspeed = baud; }