FD_ZERO(&readfds);
FD_SET(PtyRDFD,&readfds);
+ FD_SET(device_portfd,&readfds);
timeout.tv_sec=2;
timeout.tv_usec=0;/*500*1000;*/
- res = select(PtyRDFD+1,&readfds,NULL/*writefds*/,NULL/*exceptfds*/,&timeout);
+ res = select((device_portfd > PtyRDFD ? device_portfd : PtyRDFD)+1,
+ &readfds,NULL/*writefds*/,NULL/*exceptfds*/,&timeout);
switch (res) {
case 0: /* Timeout */
return (false);
default:
- if (FD_ISSET(PtyRDFD,&readfds)) {
+ if (FD_ISSET(PtyRDFD,&readfds))
VM_CharHandler();
- } else usleep(500); /* Probably the file has been closed */
+ if (FD_ISSET(device_portfd,&readfds))
+ SigHandler(0);
+ if (!FD_ISSET(PtyRDFD,&readfds) && !FD_ISSET(device_portfd,&readfds))
+ usleep(500); /* Probably the file has been closed */
break;
}
}