about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/utmps/utmps-utmpd.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/utmps/utmps-utmpd.c b/src/utmps/utmps-utmpd.c
index 32d174b..42fb4ed 100644
--- a/src/utmps/utmps-utmpd.c
+++ b/src/utmps/utmps-utmpd.c
@@ -156,16 +156,18 @@ static void do_putline (uid_t uid)
   {
     struct utmpx b ;
     char tmp[sizeof(struct utmpx)] ;
-    if (!read_utmp_entry(tmp)) goto writeit ;
+    if (!read_utmp_entry(tmp)) break ;
     utmps_utmpx_unpack(tmp, &b) ;
-    if (idmatch(u.ut_type, u.ut_id, &b)) break ;
-  }
-  if (lseek(fd, -(off_t)sizeof(struct utmpx), SEEK_CUR) < 0)
-  {
-    answer(errno) ;
-    return ;
+    if (idmatch(u.ut_type, u.ut_id, &b) && !strncmp(u.ut_line, b.ut_line, UTMPS_UT_LINESIZE - 1))
+    {
+      if (lseek(fd, -(off_t)sizeof(struct utmpx), SEEK_CUR) < 0)
+      {
+        answer(errno) ;
+        return ;
+      }
+      break ;
+    }
   }
- writeit:
   utmps_utmpx_pack(buf, &u) ;
   if (lock_ex(fd) < 0) { answer(errno) ; return ; }
   if (allwrite(fd, buf, sizeof(struct utmpx)) < sizeof(struct utmpx))