From ec5a5a549cf43c265752b0b754737dec27c333e1 Mon Sep 17 00:00:00 2001 From: "Evgeny Grin (Karlson2k)" Date: Tue, 15 Jul 2025 16:36:07 +0200 Subject: [PATCH] lib/utmp.c: Additional refactoring for readability Signed-off-by: Evgeny Grin (Karlson2k) --- lib/utmp.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/utmp.c b/lib/utmp.c index 2b342a1ba..7c44aea46 100644 --- a/lib/utmp.c +++ b/lib/utmp.c @@ -152,7 +152,6 @@ static /*@null@*/ /*@only@*/struct utmpx * get_current_utmp(void) { struct utmpx *ut; - struct utmpx *ret = NULL; setutxent(); @@ -174,13 +173,16 @@ get_current_utmp(void) } if (NULL != ut) { - ret = XMALLOC(1, struct utmpx); - memcpy (ret, ut, sizeof (*ret)); + struct utmpx *ut_copy; + + ut_copy = XMALLOC(1, struct utmpx); + memcpy(ut_copy, ut, sizeof(*ut)); + ut = ut_copy; } endutxent(); - return ret; + return ut; } -- 2.47.3