[gdm/rhel-7.9: 15/51] daemon/gdm-session-record.c: open/close the utmp database
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gdm/rhel-7.9: 15/51] daemon/gdm-session-record.c: open/close the utmp database
- Date: Mon, 12 Apr 2021 20:58:09 +0000 (UTC)
commit 2da704c857d520a248f7e10096c5507cddef9df5
Author: Jason Pleau <jason jpleau ca>
Date: Wed May 30 21:48:22 2018 -0400
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
daemon/gdm-session-record.c | 4 ++++
1 file changed, 4 insertions(+)
---
diff --git a/daemon/gdm-session-record.c b/daemon/gdm-session-record.c
index 487f10047..d2df58873 100644
--- a/daemon/gdm-session-record.c
+++ b/daemon/gdm-session-record.c
@@ -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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]