diff options
author | Ruediger Meier | 2016-12-01 09:52:11 +0100 |
---|---|---|
committer | Karel Zak | 2016-12-07 12:35:24 +0100 |
commit | b4b919fe5e1fc1d346fa6315748d0e0709d02096 (patch) | |
tree | e5eba9e27c382d608ab4c93edc1892d88d84e876 /term-utils/agetty.c | |
parent | agetty: remove obsolete HAVE_UPDWTMP fallback (diff) | |
download | kernel-qcow2-util-linux-b4b919fe5e1fc1d346fa6315748d0e0709d02096.tar.gz kernel-qcow2-util-linux-b4b919fe5e1fc1d346fa6315748d0e0709d02096.tar.xz kernel-qcow2-util-linux-b4b919fe5e1fc1d346fa6315748d0e0709d02096.zip |
login-utils: switch to utmpx.h
Now the build will fail on many non-Linux systems because
utmpx.h is available everywhere but we still use non-POSIX
features. We'll fix this next commit.
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Diffstat (limited to 'term-utils/agetty.c')
-rw-r--r-- | term-utils/agetty.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/term-utils/agetty.c b/term-utils/agetty.c index 0f114a532..46eea0122 100644 --- a/term-utils/agetty.c +++ b/term-utils/agetty.c @@ -25,7 +25,7 @@ #include <fcntl.h> #include <stdarg.h> #include <ctype.h> -#include <utmp.h> +#include <utmpx.h> #include <getopt.h> #include <time.h> #include <sys/socket.h> @@ -884,13 +884,13 @@ static void parse_speeds(struct options *op, char *arg) /* Update our utmp entry. */ static void update_utmp(struct options *op) { - struct utmp ut; + struct utmpx ut; time_t t; pid_t pid = getpid(); pid_t sid = getsid(0); char *vcline = op->vcline; char *line = op->tty; - struct utmp *utp; + struct utmpx *utp; /* * The utmp file holds miscellaneous information about things started by @@ -900,8 +900,8 @@ static void update_utmp(struct options *op) * utmp file can be opened for update, and if we are able to find our * entry in the utmp file. */ - utmpname(_PATH_UTMP); - setutent(); + utmpxname(_PATH_UTMP); + setutxent(); /* * Find my pid in utmp. @@ -912,7 +912,7 @@ static void update_utmp(struct options *op) * FIXME: The present code is taken from login.c, so if this is changed, * maybe login has to be changed as well (is this true?). */ - while ((utp = getutent())) + while ((utp = getutxent())) if (utp->ut_pid == pid && utp->ut_type >= INIT_PROCESS && utp->ut_type <= DEAD_PROCESS) @@ -947,10 +947,10 @@ static void update_utmp(struct options *op) ut.ut_pid = pid; ut.ut_session = sid; - pututline(&ut); - endutent(); + pututxline(&ut); + endutxent(); - updwtmp(_PATH_WTMP, &ut); + updwtmpx(_PATH_WTMP, &ut); } #endif /* SYSV_STYLE */ @@ -2448,12 +2448,12 @@ static void output_special_char(unsigned char c, struct options *op, case 'U': { int users = 0; - struct utmp *ut; - setutent(); - while ((ut = getutent())) + struct utmpx *ut; + setutxent(); + while ((ut = getutxent())) if (ut->ut_type == USER_PROCESS) users++; - endutent(); + endutxent(); if (c == 'U') printf(P_("%d user", "%d users", users), users); else |