Skip to content

Commit 9f55b18

Browse files
lib/utmp.c: get_current_utmp(): Move MEMDUP() to the return statement
This removes the reuse of 'ut', with which I wasn't entirely happy. It also reduces the scope between setutxent()/endutxent(). Signed-off-by: Alejandro Colomar <[email protected]>
1 parent eb01f5a commit 9f55b18

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

lib/utmp.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,11 +194,9 @@ get_current_utmp(pid_t main_pid)
194194
}
195195
}
196196

197-
ut = match ? MEMDUP(&ut_copy, struct utmpx) : NULL;
198-
199197
endutxent();
200198

201-
return ut;
199+
return match ? MEMDUP(&ut_copy, struct utmpx) : NULL;
202200
}
203201

204202

0 commit comments

Comments
 (0)