Rewrite to allow omitting initialization of global variables.
[kopensolaris-gnu/glibc.git] / misc / ttyslot.c
index 430f9c0..7dc9b27 100644 (file)
@@ -60,11 +60,11 @@ ttyslot()
        setttyent();
        for (cnt = 0; cnt < 3; ++cnt)
                if (__ttyname_r (cnt, name, buflen) == 0) {
-                       if (p = rindex(name, '/'))
+                       if ((p = rindex(name, '/')))
                                ++p;
                        else
                                p = name;
-                       for (slot = 1; ttyp = getttyent(); ++slot)
+                       for (slot = 1; (ttyp = getttyent()); ++slot)
                                if (!strcmp(ttyp->ty_name, p)) {
                                        endttyent();
                                        return(slot);