about summary refs log tree commit diff
path: root/nss/nss_files/files-XXX.c
diff options
context:
space:
mode:
Diffstat (limited to 'nss/nss_files/files-XXX.c')
-rw-r--r--nss/nss_files/files-XXX.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/nss/nss_files/files-XXX.c b/nss/nss_files/files-XXX.c
index 6933986026..d6a7911b66 100644
--- a/nss/nss_files/files-XXX.c
+++ b/nss/nss_files/files-XXX.c
@@ -224,7 +224,16 @@ CONCAT(_nss_files_get,ENTNAME_r) (struct STRUCTURE *result, char *buffer,
 
   /* Be prepared that the set*ent function was not called before.  */
   if (stream == NULL)
-    status = internal_setent (0);
+    {
+      status = internal_setent (0);
+
+      if (status == NSS_STATUS_SUCCESS && fgetpos (stream, &position) < 0)
+	{
+	  fclose (stream);
+	  stream = NULL;
+	  status = NSS_STATUS_UNAVAIL;
+	}
+    }
 
   if (status == NSS_STATUS_SUCCESS)
     {