lib/port.c: getttyuser(): Use goto to break out of nested loops

Signed-off-by: Alejandro Colomar <alx@kernel.org>
This commit is contained in:
Alejandro Colomar
2024-07-06 07:44:02 -05:00
committed by Serge Hallyn
parent a4b91048e9
commit bf84b3a855
+4 -6
View 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;
}