From: Alejandro Colomar Date: Tue, 2 Jul 2024 13:49:48 +0000 (+0200) Subject: lib/port.c: getttyuser(): Use goto to break out of nested loops X-Git-Tag: 4.17.0-rc1~141 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bf84b3a8555d;p=thirdparty%2Fshadow.git lib/port.c: getttyuser(): Use goto to break out of nested loops Signed-off-by: Alejandro Colomar --- diff --git a/lib/port.c b/lib/port.c index 14ab06c96..04dc5c1c2 100644 --- a/lib/port.c +++ b/lib/port.c @@ -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; }