about summary refs log tree commit diff
path: root/misc/mntent_r.c
diff options
context:
space:
mode:
Diffstat (limited to 'misc/mntent_r.c')
-rw-r--r--misc/mntent_r.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/misc/mntent_r.c b/misc/mntent_r.c
index 9567a6f077..94b1d15c71 100644
--- a/misc/mntent_r.c
+++ b/misc/mntent_r.c
@@ -57,7 +57,10 @@ __getmntent_r (FILE *stream, struct mntent *mp, char *buffer, int bufsiz)
       char *end_ptr;
 
       if (fgets_unlocked (buffer, bufsiz, stream) == NULL)
-	return NULL;
+	{
+	  funlockfile (stream);
+	  return NULL;
+	}
 
       end_ptr = strchr (buffer, '\n');
       if (end_ptr != NULL)	/* chop newline */