Revision d7aae2f0 src/net_helper.c

View differences:

src/net_helper.c
27 27
  int i, res, max_fd;
28 28

  
29 29
  FD_ZERO(&fds);
30
  max_fd = s->fd;
30
  if (s) {
31
    max_fd = s->fd;
32
    FD_SET(s->fd, &fds);
33
  } else {
34
    max_fd = -1;
35
  }
31 36
  if (user_fds) {
32 37
    for (i = 0; user_fds[i] != -1; i++) {
33 38
      FD_SET(user_fds[i], &fds);
......
36 41
      }
37 42
    }
38 43
  }
39
  FD_SET(s->fd, &fds);
40 44
  res = select(max_fd + 1, &fds, NULL, NULL, tout);
41 45
  if (res <= 0) {
42 46
    return res;
43 47
  }
44
  if (FD_ISSET(s->fd, &fds)) {
48
  if (s && FD_ISSET(s->fd, &fds)) {
45 49
    return 1;
46 50
  }
47 51

  

Also available in: Unified diff