020-handle_timeout.patch 652 B

1234567891011121314151617181920212223242526272829303132
  1. --- a/lib/autofs.c
  2. +++ b/lib/autofs.c
  3. @@ -140,6 +140,7 @@ static int fullread(void *ptr, size_t le
  4. static int autofs_in(union autofs_v5_packet_union *pkt)
  5. {
  6. + int res;
  7. struct pollfd fds[1];
  8. fds[0].fd = fdout;
  9. @@ -147,15 +148,19 @@ static int autofs_in(union autofs_v5_pac
  10. while(1)
  11. {
  12. - if(poll(fds, 2, 1000) == -1)
  13. + res = poll(fds, 1, -1);
  14. +
  15. + if (res == -1)
  16. {
  17. if (errno == EINTR)
  18. continue;
  19. log_printf("failed while trying to read packet from kernel\n");
  20. return -1;
  21. }
  22. - if(fds[0].revents & POLLIN)
  23. + else if ((res > 0) && (fds[0].revents & POLLIN))
  24. + {
  25. return fullread(pkt, sizeof(*pkt));
  26. + }
  27. }
  28. }