diff options
author | Eric Andersen <andersen@codepoet.org> | 2002-06-23 04:24:25 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2002-06-23 04:24:25 +0000 |
commit | 27f64e1f4eb4354844f6553e37501deffde8373e (patch) | |
tree | 632fbb26b13ad67f6efa335c33a22551b2707930 /libbb/libc5.c | |
parent | 0fbff134f400ea51540cfd6ef5eeaeab60f9a5de (diff) |
Port over the last of the tinylogin applets
-Erik
Diffstat (limited to 'libbb/libc5.c')
-rw-r--r-- | libbb/libc5.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/libbb/libc5.c b/libbb/libc5.c index df622f65b..af15d1ac7 100644 --- a/libbb/libc5.c +++ b/libbb/libc5.c @@ -11,6 +11,24 @@ #if __GNU_LIBRARY__ < 5 +/* + * Some systems already have updwtmp(). Some don't... This is + * the updwtmp() implementation from uClibc, Copyright 2002 by + * Erik Andersen <andersee@debian.org> + */ +extern void updwtmp(const char *wtmp_file, const struct utmp *lutmp) +{ + int fd; + + fd = open(wtmp_file, O_APPEND | O_WRONLY, 0); + if (fd >= 0) { + if (lockf(fd, F_LOCK, 0)==0) { + write(fd, (const char *) lutmp, sizeof(struct utmp)); + lockf(fd, F_ULOCK, 0); + close(fd); + } + } +} /* Copyright (C) 1991 Free Software Foundation, Inc. This file is part of the GNU C Library. |