From 478ebbd14a9aead9adfa2d75bd68059a682a2f9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sun, 20 Jan 2008 12:10:41 +0000 Subject: [PATCH] Fixed an endless loop when iterating over all hosts (when there was no /etc/hosts file). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23660 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/network/dns/irs/lcl_ho.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/kits/network/dns/irs/lcl_ho.c b/src/kits/network/dns/irs/lcl_ho.c index 3a0f873075..e488d5badd 100644 --- a/src/kits/network/dns/irs/lcl_ho.c +++ b/src/kits/network/dns/irs/lcl_ho.c @@ -1,5 +1,5 @@ /* - * Copyright 2007, Haiku, Inc. All Rights Reserved. + * Copyright 2007-2008, Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ @@ -336,12 +336,11 @@ ho_next(struct irs_ho *this) { if (init(this) == -1) return (NULL); + if (pvt->index > 0) + return (NULL); if (!pvt->fp) ho_rewind(this); if (!pvt->fp) { - if (pvt->index > 0) - return (NULL); - strcpy(pvt->hostbuf, "localhost"); pvt->host_aliases[0] = NULL; pvt->h_addr_ptrs[0] = (char *)pvt->host_addr;