summaryrefslogtreecommitdiff
path: root/libutil/logwtmp.c
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2015-03-25 23:59:45 +0100
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2015-03-25 23:59:45 +0100
commit6ff9c31abc14f207265ab214370982ecb3bfe428 (patch)
treeafdaf5624e71c939c39abe8ef3aba5980aa4d911 /libutil/logwtmp.c
parent2b33716c08cc506e57115e34b5fe11d8d5477398 (diff)
utmp: favour POSIX utmpx over SVID utmp
Note: _PATH_UTMPX == _PATH_UTMP and the utmp struct is identical to the utmpx struct so this only changes the external API entrypoints and NOT the underlying data source. This saves about 500b (~1300b from previously ~1950) while at it. Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Diffstat (limited to 'libutil/logwtmp.c')
-rw-r--r--libutil/logwtmp.c21
1 files changed, 2 insertions, 19 deletions
diff --git a/libutil/logwtmp.c b/libutil/logwtmp.c
index 6a53b5ff1..99b772fc4 100644
--- a/libutil/logwtmp.c
+++ b/libutil/logwtmp.c
@@ -9,13 +9,13 @@
#include <sys/time.h>
#include <time.h>
#include <unistd.h>
-#include <utmp.h>
#include <fcntl.h>
#include <sys/file.h>
+#include "internal/utmp.h"
void logwtmp(const char *line, const char *name, const char *host)
{
- struct utmp lutmp;
+ struct UT lutmp;
memset(&lutmp, 0, sizeof(lutmp));
lutmp.ut_type = (name && *name) ? USER_PROCESS : DEAD_PROCESS;
@@ -36,20 +36,3 @@ void logwtmp(const char *line, const char *name, const char *host)
updwtmp(_PATH_WTMP, &lutmp);
}
-
-#if 0
-/* This is enabled in uClibc/libc/misc/utmp/wtent.c */
-void updwtmp(const char *wtmp_file, const struct utmp *lutmp)
-{
- int fd;
-
- fd = open(wtmp_file, O_APPEND | O_WRONLY);
- if (fd >= 0) {
- if (lockf(fd, F_LOCK, 0) == 0) {
- write(fd, lutmp, sizeof(*lutmp));
- lockf(fd, F_ULOCK, 0);
- close(fd);
- }
- }
-}
-#endif