]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib/port.c: getttyuser(): Use goto to break out of nested loops
authorAlejandro Colomar <alx@kernel.org>
Tue, 2 Jul 2024 13:49:48 +0000 (15:49 +0200)
committerSerge Hallyn <serge@hallyn.com>
Sat, 6 Jul 2024 12:44:02 +0000 (07:44 -0500)
Signed-off-by: Alejandro Colomar <alx@kernel.org>
lib/port.c

index 14ab06c966d8d7fcc4495cdaed4f43c0400159a2..04dc5c1c242182efbc5ce779a17582df31f73977 100644 (file)
@@ -353,15 +353,13 @@ static struct port *getttyuser (const char *tty, const char *user)
 
                for (j = 0; NULL != port->pt_users[j]; j++) {
                        if (   (strcmp (user, port->pt_users[j]) == 0)
-                           || (strcmp (port->pt_users[j], "*") == 0)) {
-                               break;
+                           || (strcmp (port->pt_users[j], "*") == 0))
+                       {
+                               goto end;
                        }
                }
-
-               if (port->pt_users[j] != 0) {
-                       break;
-               }
        }
+end:
        endportent ();
        return port;
 }