diff options
Diffstat (limited to 'misc')
-rw-r--r-- | misc/getttyent.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/misc/getttyent.c b/misc/getttyent.c index 6743ac5..f474cdc 100644 --- a/misc/getttyent.c +++ b/misc/getttyent.c @@ -71,12 +71,13 @@ getttyent() if (!tf && !setttyent()) return (NULL); + flockfile (tf); for (;;) { if (!fgets(p = line, sizeof(line), tf)) return (NULL); /* skip lines that are too big */ if (!index(p, '\n')) { - while ((c = getc(tf)) != '\n' && c != EOF) + while ((c = getc_unlocked(tf)) != '\n' && c != EOF) ; continue; } @@ -85,6 +86,7 @@ getttyent() if (*p && *p != '#') break; } + funlockfile(tf); zapchar = 0; tty.ty_name = p; |