summaryrefslogtreecommitdiff
path: root/libc/misc
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2002-04-03 12:00:54 +0000
committerEric Andersen <andersen@codepoet.org>2002-04-03 12:00:54 +0000
commit61b43835119a979b46fbe16a9ded67b9442dc2c8 (patch)
tree3f2f675c7a58ea8648a5d5c35877ee5460636941 /libc/misc
parent7b8eeeceed5bf59b7e9558e1535f3012bb246375 (diff)
Richard June <rjune@bravegnuworld.com> noticed that pututline
was only writing the first sizeof-a-pointer bytes to the utmp file. oops. -Erik
Diffstat (limited to 'libc/misc')
-rw-r--r--libc/misc/utmp/utent.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/libc/misc/utmp/utent.c b/libc/misc/utmp/utent.c
index 4635d67ba..cc092a996 100644
--- a/libc/misc/utmp/utent.c
+++ b/libc/misc/utmp/utent.c
@@ -108,17 +108,15 @@ struct utmp *pututline (const struct utmp *utmp_entry)
/* Ignore the return value. That way, if they've already positioned
the file pointer where they want it, everything will work out. */
- (void) lseek(ut_fd, (off_t) - sizeof(utmp_entry), SEEK_CUR);
+ (void) lseek(ut_fd, (off_t) - sizeof(struct utmp), SEEK_CUR);
if ((ut = getutid(utmp_entry)) != NULL) {
- lseek(ut_fd, (off_t) - sizeof(utmp_entry), SEEK_CUR);
- if (write(ut_fd, (char *) utmp_entry, sizeof(utmp_entry))
- != sizeof(utmp_entry))
+ lseek(ut_fd, (off_t) - sizeof(struct utmp), SEEK_CUR);
+ if (write(ut_fd, utmp_entry, sizeof(struct utmp)) != sizeof(struct utmp))
return NULL;
} else {
lseek(ut_fd, (off_t) 0, SEEK_END);
- if (write(ut_fd, (char *) utmp_entry, sizeof(utmp_entry))
- != sizeof(utmp_entry))
+ if (write(ut_fd, utmp_entry, sizeof(struct utmp)) != sizeof(struct utmp))
return NULL;
}