diff options
Diffstat (limited to 'libc/misc/ttyent')
-rw-r--r-- | libc/misc/ttyent/getttyent.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/libc/misc/ttyent/getttyent.c b/libc/misc/ttyent/getttyent.c index 18b9109af..0b2c9a3cc 100644 --- a/libc/misc/ttyent/getttyent.c +++ b/libc/misc/ttyent/getttyent.c @@ -99,11 +99,19 @@ struct ttyent * getttyent(void) { register int c; register char *p; - static char line[BUFSIZ]; + static char *line = NULL; if (!tf && !setttyent()) return (NULL); + + if (!line) { + line = malloc(BUFSIZ); + if (!line) + abort(); + } + flockfile (tf); + for (;;) { if (!fgets_unlocked(p = line, sizeof(line), tf)) { funlockfile (tf); |