]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib/utmp.c: Additional refactoring for readability
authorEvgeny Grin (Karlson2k) <k2k@drgrin.dev>
Tue, 15 Jul 2025 14:36:07 +0000 (16:36 +0200)
committerAlejandro Colomar <foss+github@alejandro-colomar.es>
Fri, 18 Jul 2025 19:55:10 +0000 (21:55 +0200)
Signed-off-by: Evgeny Grin (Karlson2k) <k2k@drgrin.dev>
lib/utmp.c

index 2b342a1bafc902c92c4ee24e51b087bb134e3d50..7c44aea462ac736c3e2982825edc339cef5472f1 100644 (file)
@@ -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;
 }