From 212d75c150deb2a664f97d56b539fef5126023f7 Mon Sep 17 00:00:00 2001 From: "Evgeny Grin (Karlson2k)" Date: Tue, 15 Jul 2025 16:34:21 +0200 Subject: [PATCH] lib/utmp.c: Refactoring for readability Signed-off-by: Evgeny Grin (Karlson2k) --- lib/utmp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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)) -- 2.47.2