diff options
author | Jakub Jelinek <jakub@redhat.com> | 2006-11-28 11:18:19 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2006-11-28 11:18:19 +0000 |
commit | f12ca311c01cba335a9e4c866a0c966d2efd41a2 (patch) | |
tree | 0740f05d6deda7041887e5dfa9b981f280ff8f0c /sunrpc | |
parent | 9a40233fa0d4c587880f5d3d3f42813ec6e6ae32 (diff) | |
download | glibc-f12ca311c01cba335a9e4c866a0c966d2efd41a2.tar.gz glibc-f12ca311c01cba335a9e4c866a0c966d2efd41a2.tar.xz glibc-f12ca311c01cba335a9e4c866a0c966d2efd41a2.zip |
Updated to fedora-glibc-20061128T1037 cvs/fedora-glibc-2_5_90-8
Diffstat (limited to 'sunrpc')
-rw-r--r-- | sunrpc/svc_run.c | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/sunrpc/svc_run.c b/sunrpc/svc_run.c index 017910b453..feb1bf958e 100644 --- a/sunrpc/svc_run.c +++ b/sunrpc/svc_run.c @@ -51,36 +51,51 @@ void svc_run (void) { int i; + struct pollfd *my_pollfd = NULL; + int last_max_pollfd = 0; for (;;) { - struct pollfd *my_pollfd; + int max_pollfd = svc_max_pollfd; + if (max_pollfd == 0 && svc_pollfd == NULL) + break; - if (svc_max_pollfd == 0 && svc_pollfd == NULL) - return; + if (last_max_pollfd != max_pollfd) + { + struct pollfd *new_pollfd + = realloc (my_pollfd, sizeof (struct pollfd) * max_pollfd); + + if (new_pollfd == NULL) + { + perror (_("svc_run: - out of memory")); + break; + } + + last_max_pollfd = max_pollfd; + } - my_pollfd = malloc (sizeof (struct pollfd) * svc_max_pollfd); - for (i = 0; i < svc_max_pollfd; ++i) + for (i = 0; i < max_pollfd; ++i) { my_pollfd[i].fd = svc_pollfd[i].fd; my_pollfd[i].events = svc_pollfd[i].events; my_pollfd[i].revents = 0; } - switch (i = __poll (my_pollfd, svc_max_pollfd, -1)) + switch (i = __poll (my_pollfd, max_pollfd, -1)) { case -1: - free (my_pollfd); if (errno == EINTR) continue; perror (_("svc_run: - poll failed")); - return; + break; case 0: - free (my_pollfd); continue; default: INTUSE(svc_getreq_poll) (my_pollfd, i); - free (my_pollfd); + continue; } + break; } + + free (my_pollfd); } |