]> Savannah Git Hosting - gnulib.git/commitdiff
readutmp: systemd supports only UTMP_FILE
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 3 Aug 2023 23:01:52 +0000 (16:01 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 4 Aug 2023 01:20:51 +0000 (18:20 -0700)
* lib/readutmp.c (read_utmp): Fail if not UTMP_FILE.
* m4/systemd.m4 (gl_SYSTEMD_CHOICE): Default to no for now,
since yes means "who /var/log/wtmp" stops working.

ChangeLog
lib/readutmp.c
m4/systemd.m4

index 133f49df97c29506c9f477802e2b5944a26986a0..8730fd9bc8a617e3b0f090ca746117be903f1deb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2023-08-03  Paul Eggert  <eggert@cs.ucla.edu>
 
+       readutmp: systemd supports only UTMP_FILE
+       * lib/readutmp.c (read_utmp): Fail if not UTMP_FILE.
+       * m4/systemd.m4 (gl_SYSTEMD_CHOICE): Default to no for now,
+       since yes means "who /var/log/wtmp" stops working.
+
        readutmp: switch new struct to struct timespec
        * lib/readutmp.c (get_boot_time_uncached, get_boot_time)
        (add_utmp, read_utmp):
index 113382c636d425f49606730a9d13f21fd1499c63..c692b3854d57c6465390f2f2fb707c71b158f06b 100644 (file)
@@ -305,6 +305,13 @@ int
 read_utmp (char const *file, idx_t *n_entries, STRUCT_UTMP **utmp_buf,
            int options)
 {
+  /* The current implementation can imitate only UTMP_FILE.  */
+  if (strcmp (file, UTMP_FILE) != 0)
+    {
+      errno = ENOTSUP;
+      return -1;
+    }
+
   /* Fill entries, simulating what a utmp file would contain.  */
   struct utmp_alloc a = {0};
 
index 0c919385b24b0f6c879559145b81ebc2914eb435..c54e2fb47f10bae7a3d25fbce88dccfd2fdbbb7b 100644 (file)
@@ -1,4 +1,4 @@
-# systemd.m4 serial 1
+# systemd.m4 serial 2
 dnl Copyright (C) 2023 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -10,9 +10,9 @@ AC_DEFUN([gl_SYSTEMD_CHOICE],
 [
   AC_MSG_CHECKING([whether to use systemd APIs])
   AC_ARG_ENABLE([systemd],
-    [  --disable-systemd       do not use systemd APIs],
+    [  --enable-systemd       use systemd APIs],
     [SYSTEMD_CHOICE="$enableval"],
-    [SYSTEMD_CHOICE=yes])
+    [SYSTEMD_CHOICE=no])
   AC_MSG_RESULT([$SYSTEMD_CHOICE])
   AC_SUBST([SYSTEMD_CHOICE])
 ])