about summary refs log tree commit diff
path: root/misc
diff options
context:
space:
mode:
Diffstat (limited to 'misc')
-rw-r--r--misc/getttyent.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/misc/getttyent.c b/misc/getttyent.c
index f73cb79cda..009ad9c7f6 100644
--- a/misc/getttyent.c
+++ b/misc/getttyent.c
@@ -93,7 +93,6 @@ getttyent()
 		if (*p && *p != '#')
 			break;
 	}
-	funlockfile(tf);
 
 	zapchar = 0;
 	tty.ty_name = p;
@@ -124,6 +123,8 @@ getttyent()
 		else
 			break;
 	}
+	/* We can release the lock only here since `zapchar' is global.  */
+	funlockfile(tf);
 
 	if (zapchar == '#' || *p == '#')
 		while ((c = *++p) == ' ' || c == '\t')