diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2020-07-02 16:24:04 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2020-07-05 12:16:01 +0200 |
commit | c2a99093777aaa2e639261b66feddd1405f236a3 (patch) | |
tree | 04a4190966a9328734f8bf8a9e1c4bdccd917ba6 /src/shared/utmp-wtmp.h | |
parent | 272ac70a21165b6220f177a5f5db3c7863f7729c (diff) | |
download | systemd-c2a99093777aaa2e639261b66feddd1405f236a3.tar.gz |
Define _cleanup_ helper for setutxent()+endutxent()
Diffstat (limited to 'src/shared/utmp-wtmp.h')
-rw-r--r-- | src/shared/utmp-wtmp.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/shared/utmp-wtmp.h b/src/shared/utmp-wtmp.h index 9e433cf73e..fe55bad12d 100644 --- a/src/shared/utmp-wtmp.h +++ b/src/shared/utmp-wtmp.h @@ -8,6 +8,8 @@ #include "util.h" #if ENABLE_UTMP +#include <utmpx.h> + int utmp_get_runlevel(int *runlevel, int *previous); int utmp_put_shutdown(void); @@ -24,6 +26,15 @@ int utmp_wall( bool (*match_tty)(const char *tty, void *userdata), void *userdata); +static inline bool utxent_start(void) { + setutxent(); + return true; +} +static inline void utxent_cleanup(bool *initialized) { + if (initialized) + endutxent(); +} + #else /* ENABLE_UTMP */ static inline int utmp_get_runlevel(int *runlevel, int *previous) { |