diff options
author | Ulrich Drepper <drepper@redhat.com> | 2006-04-01 18:51:15 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2006-04-01 18:51:15 +0000 |
commit | 9388dcbb84dd616b20823ac46c8630b8c2845a82 (patch) | |
tree | d97ec2fd5109de9bb8f367b9e1b42178e3d081b8 /nscd | |
parent | * sysdeps/unix/sysv/linux/Versions: Export sync_file_range with (diff) | |
download | glibc-9388dcbb84dd616b20823ac46c8630b8c2845a82.tar.gz glibc-9388dcbb84dd616b20823ac46c8630b8c2845a82.tar.bz2 glibc-9388dcbb84dd616b20823ac46c8630b8c2845a82.zip |
[BZ #2498]
2006-04-01 Ulrich Drepper <drepper@redhat.com>
[BZ #2498]
* nscd/connections.c (main_loop_poll): If the connection cannot be
accepted because of user-imposed limits close the descriptor.
Diffstat (limited to 'nscd')
-rw-r--r-- | nscd/connections.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/nscd/connections.c b/nscd/connections.c index 802b7c02d2..d975b1818f 100644 --- a/nscd/connections.c +++ b/nscd/connections.c @@ -1556,18 +1556,24 @@ main_loop_poll (void) /* We have a new incoming connection. Accept the connection. */ int fd = TEMP_FAILURE_RETRY (accept (sock, NULL, NULL)); - /* use the descriptor if we have not reached the limit. */ - if (fd >= 0 && firstfree < nconns) + /* Use the descriptor if we have not reached the limit. */ + if (fd >= 0) { - conns[firstfree].fd = fd; - conns[firstfree].events = POLLRDNORM; - starttime[firstfree] = now; - if (firstfree >= nused) - nused = firstfree + 1; - - do - ++firstfree; - while (firstfree < nused && conns[firstfree].fd != -1); + if (firstfree < nconns) + { + conns[firstfree].fd = fd; + conns[firstfree].events = POLLRDNORM; + starttime[firstfree] = now; + if (firstfree >= nused) + nused = firstfree + 1; + + do + ++firstfree; + while (firstfree < nused && conns[firstfree].fd != -1); + } + else + /* We cannot use the connection so close it. */ + close (fd); } --n; |