about summary refs log tree commit diff
path: root/misc/getttyent.c
diff options
context:
space:
mode:
Diffstat (limited to 'misc/getttyent.c')
-rw-r--r--misc/getttyent.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/misc/getttyent.c b/misc/getttyent.c
index 07018f7051..e886e58b8e 100644
--- a/misc/getttyent.c
+++ b/misc/getttyent.c
@@ -73,8 +73,10 @@ getttyent()
 		return (NULL);
 	flockfile (tf);
 	for (;;) {
-		if (!fgets_unlocked(p = line, sizeof(line), tf))
+		if (!fgets_unlocked(p = line, sizeof(line), tf)) {
+			funlockfile (tf);
 			return (NULL);
+		}
 		/* skip lines that are too big */
 		if (!index(p, '\n')) {
 			while ((c = getc_unlocked(tf)) != '\n' && c != EOF)