Changeset 4025


Ignore:
Timestamp:
11/30/10 22:21:45 (10 years ago)
Author:
_network
Message:

ignore signals in IO_Serial_WaitToRead()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/csctapi/io_serial.c

    r3953 r4025  
    641641   tv.tv_sec = timeout_ms/1000;
    642642   tv.tv_usec = (timeout_ms % 1000) * 1000L;
    643    select_ret = select(in_fd+1, &rfds, NULL,  &erfds, &tv);
    644    if(select_ret==-1)
    645    {
    646     cs_log("ERROR in IO_Serial_WaitToRead: select_ret=%i, errno=%d", select_ret, errno);
    647     if (errno==4) {
    648         //FIXME
    649         // try again in case of Interrupted system call
     643
     644    while (1) {
    650645        select_ret = select(in_fd+1, &rfds, NULL,  &erfds, &tv);
    651         if(select_ret==-1) {
    652             cs_log("ERROR in IO_Serial_WaitToRead(2): select_ret=%i, errno=%d", select_ret, errno);
     646        if (select_ret==-1) {
     647            cs_log("ERROR in IO_Serial_WaitToRead: errno=%d", errno);
     648            if (errno==EINTR) {
     649                //try again in case of Interrupted system call
     650                continue;
     651            } else
     652                return ERROR;
     653        }
     654        if (select_ret==0) {
     655            cs_log("TIMEOUT in IO_Serial_WaitToRead");
    653656            return ERROR;
    654657        }
    655 
    656     } else
    657         return ERROR;
    658    }
    659 
    660    if (FD_ISSET(in_fd, &erfds))
    661    {
    662             cs_log("ERROR in IO_Serial_WaitToRead: fd is in error fds, errno=%d", errno);
    663       return ERROR;
    664    }
    665    if (FD_ISSET(in_fd,&rfds))
    666          return OK;
    667      else
    668          return ERROR;
     658        break;
     659    }
     660
     661    if (FD_ISSET(in_fd, &erfds)) {
     662        cs_log("ERROR in IO_Serial_WaitToRead: fd is in error fds, errno=%d", errno);
     663        return ERROR;
     664    }
     665
     666    if (FD_ISSET(in_fd,&rfds))
     667        return OK;
     668    else
     669        return ERROR;
    669670}
    670671
Note: See TracChangeset for help on using the changeset viewer.