From: Evgeny Grin (Karlson2k) Date: Tue, 15 Jul 2025 14:36:07 +0000 (+0200) Subject: lib/utmp.c: Additional refactoring for readability X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ec5a5a549cf43c265752b0b754737dec27c333e1;p=thirdparty%2Fshadow.git lib/utmp.c: Additional refactoring for readability Signed-off-by: Evgeny Grin (Karlson2k) --- 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; }