summaryrefslogtreecommitdiff
path: root/libc/misc/utmp
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-07-30 16:54:31 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-07-30 16:54:31 +0000
commit249c30a44ade5e35b88bdba43ed7ad47f540c5ce (patch)
tree944ad7a5ee2b8f39173b8af192b511d221d93d98 /libc/misc/utmp
parent1569b74b9f317694221f25f2435aa8a8c14b3ca5 (diff)
make utent.c, getpass.c use __uc_malloc
Diffstat (limited to 'libc/misc/utmp')
-rw-r--r--libc/misc/utmp/utent.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/libc/misc/utmp/utent.c b/libc/misc/utmp/utent.c
index daa68d24e..51184f01f 100644
--- a/libc/misc/utmp/utent.c
+++ b/libc/misc/utmp/utent.c
@@ -14,6 +14,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
+#include <malloc.h>
#include <fcntl.h>
#include <paths.h>
#include <errno.h>
@@ -36,9 +37,10 @@ __UCLIBC_MUTEX_STATIC(utmplock, PTHREAD_MUTEX_INITIALIZER);
/* Some global crap */
-static int static_fd = -1;
-static struct utmp static_utmp;
static const char default_file_name[] = _PATH_UTMP;
+
+static int static_fd = -1;
+static struct utmp *static_utmp;
static const char *static_ut_name = (const char *) default_file_name;
/* This function must be called with the LOCK held */
@@ -89,9 +91,11 @@ static struct utmp *__getutent(int utmp_fd)
return NULL;
}
- if (read(utmp_fd, (char *) &static_utmp, sizeof(struct utmp)) == sizeof(struct utmp))
+ free(static_utmp);
+ static_utmp = __uc_malloc(sizeof(*static_utmp));
+ if (read(utmp_fd, (char *) static_utmp, sizeof(*static_utmp)) == sizeof(*static_utmp))
{
- ret = &static_utmp;
+ ret = static_utmp;
}
return ret;