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.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/misc/getttyent.c b/misc/getttyent.c
index 3295a6edac..dfc57d5ce8 100644
--- a/misc/getttyent.c
+++ b/misc/getttyent.c
@@ -33,6 +33,7 @@ static char sccsid[] = "@(#)getttyent.c	8.1 (Berkeley) 6/4/93";
 
 #include <ttyent.h>
 #include <stdio.h>
+#include <stdio_ext.h>
 #include <ctype.h>
 #include <string.h>
 
@@ -190,8 +191,11 @@ setttyent()
 	if (tf) {
 		(void)rewind(tf);
 		return (1);
-	} else if ((tf = fopen(_PATH_TTYS, "r")))
+	} else if ((tf = fopen(_PATH_TTYS, "r"))) {
+		/* We do the locking ourselves.  */
+		__fsetlocking (tf, FSETLOCKING_BYCALLER);
 		return (1);
+	}
 	return (0);
 }