aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/tests/nss/getserv_test.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/tests/nss/getserv_test.c')
-rw-r--r--lib/libc/tests/nss/getserv_test.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/libc/tests/nss/getserv_test.c b/lib/libc/tests/nss/getserv_test.c
index d74feb113a69..cc66fdb2fa52 100644
--- a/lib/libc/tests/nss/getserv_test.c
+++ b/lib/libc/tests/nss/getserv_test.c
@@ -25,7 +25,6 @@
*
*/
-#include <sys/cdefs.h>
#include <arpa/inet.h>
#include <errno.h>
#include <netdb.h>
@@ -284,6 +283,8 @@ static int
servent_fill_test_data(struct servent_test_data *td)
{
struct servent *serv;
+ const int limit = 1024;
+ int count = 0;
setservent(1);
while ((serv = getservent()) != NULL) {
@@ -291,6 +292,8 @@ servent_fill_test_data(struct servent_test_data *td)
TEST_DATA_APPEND(servent, td, serv);
else
return (-1);
+ if (++count >= limit)
+ break;
}
endservent();