summaryrefslogtreecommitdiffstats
path: root/usr.bin/ssh/sshlogin.c
diff options
context:
space:
mode:
authorguenther <guenther@openbsd.org>2015-12-26 20:51:35 +0000
committerguenther <guenther@openbsd.org>2015-12-26 20:51:35 +0000
commit149d0f06e5dafdc3b49a9d93b23f6320cd9f534d (patch)
treebbaca63bdd8e70b564e161b6f5c0919ce15831dd /usr.bin/ssh/sshlogin.c
parentremove special characters; diff from michael reed (diff)
downloadwireguard-openbsd-149d0f06e5dafdc3b49a9d93b23f6320cd9f534d.tar.xz
wireguard-openbsd-149d0f06e5dafdc3b49a9d93b23f6320cd9f534d.zip
Use pread/pwrite instead separate lseek+read/write for lastlog.
Cast to off_t before multiplication to avoid truncation on ILP32 ok kettenis@ mmcc@
Diffstat (limited to 'usr.bin/ssh/sshlogin.c')
-rw-r--r--usr.bin/ssh/sshlogin.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/usr.bin/ssh/sshlogin.c b/usr.bin/ssh/sshlogin.c
index cd21b2e2c2a..a9c7cc91ef9 100644
--- a/usr.bin/ssh/sshlogin.c
+++ b/usr.bin/ssh/sshlogin.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshlogin.c,v 1.31 2015/01/20 23:14:00 deraadt Exp $ */
+/* $OpenBSD: sshlogin.c,v 1.32 2015/12/26 20:51:35 guenther Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -83,7 +83,7 @@ get_last_login_time(uid_t uid, const char *logname,
if (fd < 0)
return 0;
- pos = (long) uid * sizeof(ll);
+ pos = (off_t)uid * sizeof(ll);
r = lseek(fd, pos, SEEK_SET);
if (r == -1) {
error("%s: lseek: %s", __func__, strerror(errno));
@@ -176,7 +176,7 @@ record_login(pid_t pid, const char *tty, const char *user, uid_t uid,
strncpy(ll.ll_host, host, sizeof(ll.ll_host));
fd = open(lastlog, O_RDWR);
if (fd >= 0) {
- lseek(fd, (off_t) ((long) uid * sizeof(ll)), SEEK_SET);
+ lseek(fd, (off_t)uid * sizeof(ll), SEEK_SET);
if (write(fd, &ll, sizeof(ll)) != sizeof(ll))
logit("Could not write %.100s: %.100s", lastlog, strerror(errno));
close(fd);