summary refs log tree commit diff
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2018-06-16 05:16:25 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2018-06-16 05:16:25 +0000
commit82578d77f2a00d4794f4e55ae04f431340bbcada (patch)
tree54d7eaeac46fa358af5cf75dfb7548e51498353b
parent6eae274a351ce903c69977c5c4d55cc45ff6de02 (diff)
downloadutmps-82578d77f2a00d4794f4e55ae04f431340bbcada.tar.gz
utmps-82578d77f2a00d4794f4e55ae04f431340bbcada.tar.xz
utmps-82578d77f2a00d4794f4e55ae04f431340bbcada.zip
Small bugfixes and GNU extensions
-rw-r--r--src/include/utmps/utmpx.h10
-rw-r--r--src/utmps/utmps-utmpd.c2
2 files changed, 9 insertions, 3 deletions
diff --git a/src/include/utmps/utmpx.h b/src/include/utmps/utmpx.h
index 450d54a..8f6aaa6 100644
--- a/src/include/utmps/utmpx.h
+++ b/src/include/utmps/utmpx.h
@@ -40,8 +40,6 @@ struct utmpx
   char _dummy[20] ;
 } ;
 
-#define ut_name ut_user
-
 #define EMPTY 0
 #define BOOT_TIME 2
 #define OLD_TIME 4
@@ -72,6 +70,14 @@ extern void logwtmp (char const *, char const *, char const *) ;
 /* Unused, but some packages require this macro to be present */
 #define UTMPX_FILE "/run/utmps/utmp"
 
+/* More old GNU/crap compatibility */
+#define ut_name ut_user
+#define ut_xtime ut_tv.tv_sec
+#define ut_addr ut_addr_v6[0]
+#ifndef _NO_UT_TIME
+# define ut_time ut_tv.tv_sec
+#endif
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/src/utmps/utmps-utmpd.c b/src/utmps/utmps-utmpd.c
index ecf8215..32d174b 100644
--- a/src/utmps/utmps-utmpd.c
+++ b/src/utmps/utmps-utmpd.c
@@ -160,7 +160,7 @@ static void do_putline (uid_t uid)
     utmps_utmpx_unpack(tmp, &b) ;
     if (idmatch(u.ut_type, u.ut_id, &b)) break ;
   }
-  if (lseek(fd, -sizeof(struct utmpx), SEEK_CUR) < 0)
+  if (lseek(fd, -(off_t)sizeof(struct utmpx), SEEK_CUR) < 0)
   {
     answer(errno) ;
     return ;