Commit 086d68f2 authored by Jason Pleau's avatar Jason Pleau Committed by Ray Strode

daemon/gdm-session-record.c: open/close the utmp database

pututxline() was used without first opening the utxmp database and
without closing it, preventing the logout entry from being fully
committed.

This caused the number of logged-in users to increment after each login,
as logging out did not correctly remove the user login record from utmp.

This commit wraps pututxline() between setutxent() and endutxent(),
making sure that the login/logout operation are fully flushed.

Fixes #381
parent 638c8dfe
......@@ -213,7 +213,9 @@ gdm_session_record_login (GPid session_pid,
/* Handle utmp */
#if defined(HAVE_GETUTXENT)
g_debug ("Adding or updating utmp record for login");
setutxent();
pututxline (&session_record);
endutxent();
#elif defined(HAVE_LOGIN)
login (&session_record);
#endif
......@@ -256,7 +258,9 @@ gdm_session_record_logout (GPid session_pid,
/* Handle utmp */
#if defined(HAVE_GETUTXENT)
g_debug ("Adding or updating utmp record for logout");
setutxent();
pututxline (&session_record);
endutxent();
#elif defined(HAVE_LOGOUT)
logout (session_record.ut_line);
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment