[systemd-devel] [RFC 15/25] shared/utmp-wtmp: don't fail if libc doesn't support utmpx/wtmpx
Emil Renner Berthing
systemd at esmil.dk
Thu Sep 18 06:24:51 PDT 2014
I'd like to make utmp/wtmp handling a configure option, but for
now this is the minimal change needed to make it compile with musl.
The musl utmp/wtmp functions doesn't do anything anyway.
---
src/shared/utmp-wtmp.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/shared/utmp-wtmp.c b/src/shared/utmp-wtmp.c
index e0319f0..619d6d1 100644
--- a/src/shared/utmp-wtmp.c
+++ b/src/shared/utmp-wtmp.c
@@ -63,8 +63,10 @@ int utmp_get_runlevel(int *runlevel, int *previous) {
return 0;
}
+#ifdef _PATH_UTMPX
if (utmpxname(_PATH_UTMPX) < 0)
return -errno;
+#endif
setutxent();
@@ -124,8 +126,10 @@ static int write_entry_utmp(const struct utmpx *store) {
* each entry type resp. user; i.e. basically a key/value
* table. */
+#ifdef _PATH_UTMPX
if (utmpxname(_PATH_UTMPX) < 0)
return -errno;
+#endif
setutxent();
@@ -146,7 +150,9 @@ static int write_entry_wtmp(const struct utmpx *store) {
simply appended to * the end; i.e. basically a log. */
errno = 0;
+#ifdef _PATH_WTMPX
updwtmpx(_PATH_WTMPX, store);
+#endif
return -errno;
}
--
2.1.0
More information about the systemd-devel
mailing list