X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=klibc_fixups.c;h=e68ce22b506fe62da91e689bebd1e6dbc4fbd938;hb=21d2888a0a0d238594e4124fe8020f54bfa29df5;hp=d1a452a44981bc948bfb9659db9f0a773d5d3a34;hpb=3e4414508b409a21b023b9ca4532f62003e0db97;p=elogind.git diff --git a/klibc_fixups.c b/klibc_fixups.c index d1a452a44..e68ce22b5 100644 --- a/klibc_fixups.c +++ b/klibc_fixups.c @@ -125,38 +125,4 @@ struct group *getgrnam(const char *name) return &gr; } - -int ufd = -1; - -void setutent() -{ - if (ufd < 0) - ufd = open(UTMP_FILE, O_RDONLY); - fcntl(ufd, F_SETFD, FD_CLOEXEC); - lseek(ufd, 0, SEEK_SET); -} - -void endutent() { - if (ufd < 0) - return; - close(ufd); - ufd = -1; -} - -struct utmp *getutent(void) -{ - static struct utmp utmp; - int retval; - - if (ufd < 0) { - setutent(); - if (ufd < 0) - return NULL; - } - retval = read(ufd, &utmp, sizeof(struct utmp)); - if (retval < 1) - return NULL; - return &utmp; -} - #endif