[systemd-devel] [RFC 15/25] shared/utmp-wtmp: don't fail if libc doesn't support utmpx/wtmpx
Tom Gundersen
teg at jklm.no
Thu Sep 18 08:34:59 PDT 2014
On Thu, Sep 18, 2014 at 3:24 PM, Emil Renner Berthing <systemd at esmil.dk> wrote:
> I'd like to make utmp/wtmp handling a configure option,
I think that would make more sense (and serve the same purpose), so I
suggest doing that instead.
> 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
>
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel
More information about the systemd-devel
mailing list