[BACK]Return to compress.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / file

Diff for /src/usr.bin/file/Attic/compress.c between version 1.15 and 1.16

version 1.15, 2011/01/10 20:59:42 version 1.16, 2013/04/20 19:02:57
Line 42 
Line 42 
 #endif  #endif
 #include <string.h>  #include <string.h>
 #include <errno.h>  #include <errno.h>
   #include <poll.h>
 #include <sys/types.h>  #include <sys/types.h>
 #include <sys/ioctl.h>  #include <sys/ioctl.h>
 #ifdef HAVE_SYS_WAIT_H  #ifdef HAVE_SYS_WAIT_H
Line 179 
Line 180 
         if ((canbepipe && (ioctl(fd, FIONREAD, &t) == -1)) || (t == 0)) {          if ((canbepipe && (ioctl(fd, FIONREAD, &t) == -1)) || (t == 0)) {
 #ifdef FD_ZERO  #ifdef FD_ZERO
                 for (cnt = 0;; cnt++) {                  for (cnt = 0;; cnt++) {
                         fd_set check;                          struct pollfd pfd[1];
                         struct timeval tout = {0, 100 * 1000};                          int rv;
                         int selrv;  
   
                         FD_ZERO(&check);                          pfd[0].fd = fd;
                         FD_SET(fd, &check);                          pfd[0].events = POLLIN;
   
                         /*                          /*
                          * Avoid soft deadlock: do not read if there                           * Avoid soft deadlock: do not read if there
                          * is nothing to read from sockets and pipes.                           * is nothing to read from sockets and pipes.
                          */                           */
                         selrv = select(fd + 1, &check, NULL, NULL, &tout);                          rv = poll(pfd, 1, 100);
                         if (selrv == -1) {                          if (rv == -1) {
                                 if (errno == EINTR || errno == EAGAIN)                                  if (errno == EINTR || errno == EAGAIN)
                                         continue;                                          continue;
                         } else if (selrv == 0 && cnt >= 5) {                          } else if (rv == 0 && cnt >= 5) {
                                 return 0;                                  return 0;
                         } else                          } else
                                 break;                                  break;

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.16