(__getmntent_r): Don't return with locked stream.
[kopensolaris-gnu/glibc.git] / misc / getttyent.c
index f474cdc..e886e58 100644 (file)
@@ -73,8 +73,10 @@ getttyent()
                return (NULL);
        flockfile (tf);
        for (;;) {
-               if (!fgets(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)