Signed-off-by: Alejandro Colomar <alx@kernel.org>
Cherry-picked-from:
bf84b3a8555d ("lib/port.c: getttyuser(): Use goto to break out of nested loops")
Link: <https://github.com/shadow-maint/shadow/pull/1037>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
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;
}