1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-02-02 14:51:23 +00:00

FD_ISSET requires that the fd being tested is >= 0 (#78)

* FD_ISSET requires that the fd being tested is >= 0, so unset fd -1 causes trouble.

* Remove code to enable X I/O signal generation from xinit.c

If the I/O signals are enabled before the signal handler has
been set up, the default action on receipt of a SIGPOLL or SIGIO
will be that the program exits.  For now, turn the signals off,
as they aren't necessary and may not even be an improvement.

* Ensure fds are declared as signed and initialized (to -1)

The global fds may be accessed from the signal handler before any
particular device has been opened.  Ensure that the fds are initialized
statically and that the value is distinguishable from all valid descriptors.

	modified:   initdsp.c
	modified:   initkbd.c
	modified:   keyevent.c
	modified:   osmsg.c
	modified:   rs232c.c
	modified:   timer.c
	modified:   tty.c
This commit is contained in:
Nick Briggs
2020-12-16 22:09:18 -08:00
committed by GitHub
parent 0d4d9a5368
commit fe0f9fff2c
8 changed files with 13 additions and 16 deletions

View File

@@ -124,11 +124,11 @@ extern fd_set LispIOFds;
fd_set LispReadFds;
int XNeedSignal = 0; /* T if an X interrupt happened while XLOCK asserted */
extern int LogFileFd;
#ifdef NOETHER
extern u_int LogFileFd;
#else
extern int ether_fd;
extern u_int LogFileFd;
#endif /* NOETHER */
extern DLword *DisplayRegion68k;
@@ -316,7 +316,7 @@ getmore:
*/
#ifdef SUNDISPLAY
if (FD_ISSET(LispWindowFd, &rfds)) {
if (LispWindowFd >= 0 && FD_ISSET(LispWindowFd, &rfds)) {
/* #endif */
while (input_readevent(LispWindowFd, &event) >= 0) {
/*if(!kb_event( &event )) {goto getmore;};*/
@@ -341,19 +341,19 @@ getmore:
#ifdef NOETHER
#else
if (FD_ISSET(ether_fd, &rfds)) { /* Raw ethernet (NIT) I/O happened, so handle it. */
if (ether_fd >= 0 && FD_ISSET(ether_fd, &rfds)) { /* Raw ethernet (NIT) I/O happened, so handle it. */
DBPRINT(("Handling enet interrupt.\n\n"));
check_ether();
}
#endif /* NOETHER */
#ifdef RS232
if (FD_ISSET(RS232C_Fd, &rfds) || (RS232C_remain_data && rs232c_lisp_is_ready()))
if (RS232C_Fd >= 0 && (FD_ISSET(RS232C_Fd, &rfds) || (RS232C_remain_data && rs232c_lisp_is_ready())))
rs232c_read();
#endif /* RS232 */
#ifdef LOGINT
if (FD_ISSET(LogFileFd, &rfds)) { /* There's info in the log file. Tell Lisp to print it. */
if (LogFileFd >= 0 && FD_ISSET(LogFileFd, &rfds)) { /* There's info in the log file. Tell Lisp to print it. */
flush_pty(); /* move the msg(s) to the log file */
((INTSTAT *)Addr68k_from_LADDR(*INTERRUPTSTATE_word))->LogFileIO = 1;