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

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