summaryrefslogtreecommitdiff
path: root/hesiod/nss_hesiod/hesiod-service.c
diff options
context:
space:
mode:
Diffstat (limited to 'hesiod/nss_hesiod/hesiod-service.c')
-rw-r--r--hesiod/nss_hesiod/hesiod-service.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/hesiod/nss_hesiod/hesiod-service.c b/hesiod/nss_hesiod/hesiod-service.c
index bd4cb612fb..cb5edd2859 100644
--- a/hesiod/nss_hesiod/hesiod-service.c
+++ b/hesiod/nss_hesiod/hesiod-service.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 2000, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Mark Kettenis <kettenis@phys.uva.nl>, 1997.
@@ -68,6 +68,7 @@ lookup (const char *name, const char *type, const char *protocol,
char **list, **item;
int parse_res;
int found;
+ int olderr = errno;
context = _nss_hesiod_init ();
if (context == NULL)
@@ -76,8 +77,10 @@ lookup (const char *name, const char *type, const char *protocol,
list = hesiod_resolve (context, name, type);
if (list == NULL)
{
+ int err = errno;
hesiod_end (context);
- return errno == ENOENT ? NSS_STATUS_NOTFOUND : NSS_STATUS_UNAVAIL;
+ __set_errno (olderr);
+ return err == ENOENT ? NSS_STATUS_NOTFOUND : NSS_STATUS_UNAVAIL;
}
linebuflen = buffer + buflen - data->linebuffer;
@@ -116,7 +119,13 @@ lookup (const char *name, const char *type, const char *protocol,
hesiod_free_list (context, list);
hesiod_end (context);
- return found ? NSS_STATUS_SUCCESS : NSS_STATUS_NOTFOUND;
+ if (found == 0)
+ {
+ __set_errno (olderr);
+ return NSS_STATUS_NOTFOUND;
+ }
+
+ return NSS_STATUS_SUCCESS;
}
enum nss_status