(getttyent): Release lock on stream later to also protect global
authordrepper <drepper>
Mon, 22 Feb 1999 17:05:39 +0000 (17:05 +0000)
committerdrepper <drepper>
Mon, 22 Feb 1999 17:05:39 +0000 (17:05 +0000)
variable zapchar.

misc/getttyent.c

index f73cb79..009ad9c 100644 (file)
@@ -93,7 +93,6 @@ getttyent()
                if (*p && *p != '#')
                        break;
        }
-       funlockfile(tf);
 
        zapchar = 0;
        tty.ty_name = p;
@@ -124,6 +123,8 @@ getttyent()
                else
                        break;
        }
+       /* We can release the lock only here since `zapchar' is global.  */
+       funlockfile(tf);
 
        if (zapchar == '#' || *p == '#')
                while ((c = *++p) == ' ' || c == '\t')