From: Evgeny Grin (Karlson2k) Date: Tue, 15 Jul 2025 14:34:21 +0000 (+0200) Subject: lib/utmp.c: Refactoring for readability X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=212d75c150deb2a664f97d56b539fef5126023f7;p=thirdparty%2Fshadow.git lib/utmp.c: Refactoring for readability Signed-off-by: Evgeny Grin (Karlson2k) --- diff --git a/lib/utmp.c b/lib/utmp.c index fade895f2..2b342a1ba 100644 --- a/lib/utmp.c +++ b/lib/utmp.c @@ -158,11 +158,13 @@ get_current_utmp(void) /* First, try to find a valid utmp entry for this process. */ while ((ut = getutxent()) != NULL) { + if ( (LOGIN_PROCESS != ut->ut_type) + && (USER_PROCESS != ut->ut_type)) + continue; + if ( ( (ut->ut_pid == getpid ()) || (ut->ut_pid == getppid ())) && ('\0' != ut->ut_id[0]) - && ( (LOGIN_PROCESS == ut->ut_type) - || (USER_PROCESS == ut->ut_type)) /* A process may have failed to close an entry * Check if this entry refers to the current tty */ && is_my_tty(ut->ut_line))