Skip to content

Commit 8e4f43f

Browse files
lib/utmp.c: get_current_utmp(): Move memdup_T() 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 00625f4 commit 8e4f43f

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
@@ -193,11 +193,9 @@ get_current_utmp(pid_t main_pid)
193193
}
194194
}
195195

196-
ut = match ? memdup_T(&ut_copy, struct utmpx) : NULL;
197-
198196
endutxent();
199197

200-
return ut;
198+
return match ? memdup_T(&ut_copy, struct utmpx) : NULL;
201199
}
202200

203201

0 commit comments

Comments
 (0)