(getttyent): Don't return with locked stream.
authordrepper <drepper>
Wed, 8 Jul 1998 22:32:08 +0000 (22:32 +0000)
committerdrepper <drepper>
Wed, 8 Jul 1998 22:32:08 +0000 (22:32 +0000)
misc/getttyent.c

index 07018f7..e886e58 100644 (file)
@@ -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)