Blame SOURCES/0001-Set-s_uwtmp_inserted-only-after-record-insertion-rem.patch

cb5a1f
From 96698a525784ad91cb27b572dd5f871c183fdfa5 Mon Sep 17 00:00:00 2001
cb5a1f
From: =?UTF-8?q?Ond=C5=99ej=20Lyson=C4=9Bk?= <olysonek@redhat.com>
cb5a1f
Date: Sun, 28 Jul 2019 12:25:35 +0200
cb5a1f
Subject: [PATCH 1/3] Set s_uwtmp_inserted only after record insertion/removal
cb5a1f
cb5a1f
pututxline() is the function that actually inserts the new record, so
cb5a1f
setting 's_uwtmp_inserted' before calling pututxline() doesn't make
cb5a1f
sense.
cb5a1f
cb5a1f
We'll need this change for other fixes.
cb5a1f
---
cb5a1f
 sysdeputil.c | 4 ++--
cb5a1f
 1 file changed, 2 insertions(+), 2 deletions(-)
cb5a1f
cb5a1f
diff --git a/sysdeputil.c b/sysdeputil.c
cb5a1f
index 4fe56c2..bd1e8c9 100644
cb5a1f
--- a/sysdeputil.c
cb5a1f
+++ b/sysdeputil.c
cb5a1f
@@ -1224,7 +1224,6 @@ vsf_insert_uwtmp(const struct mystr* p_user_str,
cb5a1f
                        sizeof(s_utent.ut_line));
cb5a1f
     str_free(&line_str);
cb5a1f
   }
cb5a1f
-  s_uwtmp_inserted = 1;
cb5a1f
   s_utent.ut_type = USER_PROCESS;
cb5a1f
   s_utent.ut_pid = vsf_sysutil_getpid();
cb5a1f
   vsf_sysutil_strcpy(s_utent.ut_user, str_getbuf(p_user_str),
cb5a1f
@@ -1235,6 +1234,7 @@ vsf_insert_uwtmp(const struct mystr* p_user_str,
cb5a1f
   setutxent();
cb5a1f
   (void) pututxline(&s_utent);
cb5a1f
   endutxent();
cb5a1f
+  s_uwtmp_inserted = 1;
cb5a1f
   updwtmpx(WTMPX_FILE, &s_utent);
cb5a1f
 }
cb5a1f
 
cb5a1f
@@ -1245,7 +1245,6 @@ vsf_remove_uwtmp(void)
cb5a1f
   {
cb5a1f
     return;
cb5a1f
   }
cb5a1f
-  s_uwtmp_inserted = 0;
cb5a1f
   s_utent.ut_type = DEAD_PROCESS;
cb5a1f
   vsf_sysutil_memclr(s_utent.ut_user, sizeof(s_utent.ut_user));
cb5a1f
   vsf_sysutil_memclr(s_utent.ut_host, sizeof(s_utent.ut_host));
cb5a1f
@@ -1253,6 +1252,7 @@ vsf_remove_uwtmp(void)
cb5a1f
   setutxent();
cb5a1f
   (void) pututxline(&s_utent);
cb5a1f
   endutxent();
cb5a1f
+  s_uwtmp_inserted = 0;
cb5a1f
   s_utent.ut_tv.tv_sec = vsf_sysutil_get_time_sec();
cb5a1f
   updwtmpx(WTMPX_FILE, &s_utent);
cb5a1f
 }
cb5a1f
-- 
cb5a1f
2.20.1
cb5a1f