]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tree-wide: use UTMPX_FILE rather than _PATH_UTMPX 34291/head
authorLennart Poettering <lennart@poettering.net>
Fri, 6 Sep 2024 11:51:51 +0000 (13:51 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 6 Sep 2024 11:54:19 +0000 (13:54 +0200)
Apparently _PATH_UTMPX is a glibc'ism. UTMPX_FILE is the same thing and
what everyone else uses. Since they are otherwise equivalent, let's just
switch.

src/login/logind-core.c
src/shared/utmp-wtmp.c
src/shared/wall.c

index 8742fe6a97ca44bb53a673b419a210ddfb53aabf..fad276f195e5c120f32337c42f4c60697b12a48b 100644 (file)
@@ -710,8 +710,8 @@ int manager_read_utmp(Manager *m) {
 
         assert(m);
 
-        if (utmpxname(_PATH_UTMPX) < 0)
-                return log_error_errno(errno, "Failed to set utmp path to " _PATH_UTMPX ": %m");
+        if (utmpxname(UTMPX_FILE) < 0)
+                return log_error_errno(errno, "Failed to set utmp path to " UTMPX_FILE ": %m");
 
         utmpx = utxent_start();
 
@@ -725,9 +725,9 @@ int manager_read_utmp(Manager *m) {
                 u = getutxent();
                 if (!u) {
                         if (errno == ENOENT)
-                                log_debug_errno(errno, _PATH_UTMPX " does not exist, ignoring.");
+                                log_debug_errno(errno, UTMPX_FILE " does not exist, ignoring.");
                         else if (errno != 0)
-                                log_warning_errno(errno, "Failed to read " _PATH_UTMPX ", ignoring: %m");
+                                log_warning_errno(errno, "Failed to read " UTMPX_FILE ", ignoring: %m");
                         return 0;
                 }
 
@@ -808,9 +808,9 @@ void manager_connect_utmp(Manager *m) {
          * Yes, relying on utmp is pretty ugly, but it's good enough for informational purposes, as well as idle
          * detection (which, for tty sessions, relies on the TTY used) */
 
-        r = sd_event_add_inotify(m->event, &s, _PATH_UTMPX, IN_MODIFY|IN_MOVE_SELF|IN_DELETE_SELF|IN_ATTRIB, manager_dispatch_utmp, m);
+        r = sd_event_add_inotify(m->event, &s, UTMPX_FILE, IN_MODIFY|IN_MOVE_SELF|IN_DELETE_SELF|IN_ATTRIB, manager_dispatch_utmp, m);
         if (r < 0)
-                log_full_errno(r == -ENOENT ? LOG_DEBUG: LOG_WARNING, r, "Failed to create inotify watch on " _PATH_UTMPX ", ignoring: %m");
+                log_full_errno(r == -ENOENT ? LOG_DEBUG: LOG_WARNING, r, "Failed to create inotify watch on " UTMPX_FILE ", ignoring: %m");
         else {
                 r = sd_event_source_set_priority(s, SD_EVENT_PRIORITY_IDLE);
                 if (r < 0)
index 267b350276c723efcdfc0f46fd3b0baf3dea6cb9..e399b1d5d77357092181f6de2c6cfb90655aa817 100644 (file)
@@ -42,7 +42,7 @@ int utmp_get_runlevel(int *runlevel, int *previous) {
                 return 0;
         }
 
-        if (utmpxname(_PATH_UTMPX) < 0)
+        if (utmpxname(UTMPX_FILE) < 0)
                 return -errno;
 
         utmpx = utxent_start();
@@ -91,7 +91,7 @@ static int write_entry_utmp(const struct utmpx *store) {
          * each entry type resp. user; i.e. basically a key/value
          * table. */
 
-        if (utmpxname(_PATH_UTMPX) < 0)
+        if (utmpxname(UTMPX_FILE) < 0)
                 return -errno;
 
         utmpx = utxent_start();
index 119d18f5a46494b0c291c10a431bc01a30d706ec..b28c04cd8b3c30fcd2449d5e9fccafd348af10e0 100644 (file)
@@ -51,7 +51,7 @@ static int wall_utmp(
 
         /* libc's setutxent() unfortunately doesn't inform us about success, i.e. whether /var/run/utmp
          * exists. Hence we have to check manually first. */
-        if (access(_PATH_UTMPX, F_OK) < 0) {
+        if (access(UTMPX_FILE, F_OK) < 0) {
                 if (errno == ENOENT)
                         return -ENOPROTOOPT;