Changeset 2514

Show
Ignore:
Timestamp:
03/18/07 16:04:42 (2 years ago)
Author:
dhozac
Message:

Attempt to fix the endless loop of select() read().

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/vlogin.c

    r2325 r2514  
    125125 
    126126/* copy terminal activities */ 
    127 static void 
     127static ssize_t 
    128128terminal_copy(int src, int dst) 
    129129{ 
     
    142142  /* write activity to user */ 
    143143  EwriteAll(dst, buf, len); 
     144 
     145  return len; 
    144146} 
    145147 
     
    277279    } 
    278280 
    279     if (FD_ISSET(STDIN_FILENO, &rfds)) 
    280       terminal_copy(STDIN_FILENO, t.fd); 
    281  
    282     if (FD_ISSET(t.fd, &rfds)) 
    283       terminal_copy(t.fd, STDOUT_FILENO); 
     281    if (FD_ISSET(STDIN_FILENO, &rfds)) { 
     282      /* EOF */ 
     283      if (terminal_copy(STDIN_FILENO, t.fd) == 0) { 
     284        terminal_kill(SIGHUP); 
     285        exit(0); 
     286      } 
     287    } 
     288 
     289    if (FD_ISSET(t.fd, &rfds)) { 
     290      /* EOF */ 
     291      if (terminal_copy(t.fd, STDOUT_FILENO) == 0) { 
     292        terminal_kill(SIGHUP); 
     293        exit(0); 
     294      } 
     295    } 
    284296  } 
    285297