aboutsummaryrefslogtreecommitdiff
path: root/nss/getXXent_r.c
diff options
context:
space:
mode:
Diffstat (limited to 'nss/getXXent_r.c')
-rw-r--r--nss/getXXent_r.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/nss/getXXent_r.c b/nss/getXXent_r.c
index 1d203db4c4..5a1e3e9b0f 100644
--- a/nss/getXXent_r.c
+++ b/nss/getXXent_r.c
@@ -137,12 +137,16 @@ ENDFUNC_NAME (void)
{
int save;
- __libc_lock_lock (lock);
- __nss_endent (ENDFUNC_NAME_STRING, DB_LOOKUP_FCT, &nip, &startp,
- &last_nip, NEED__RES);
- save = errno;
- __libc_lock_unlock (lock);
- __set_errno (save);
+ /* If the service has not been used before do not do anything. */
+ if (startp != NULL)
+ {
+ __libc_lock_lock (lock);
+ __nss_endent (ENDFUNC_NAME_STRING, DB_LOOKUP_FCT, &nip, &startp,
+ &last_nip, NEED__RES);
+ save = errno;
+ __libc_lock_unlock (lock);
+ __set_errno (save);
+ }
}