- markus@cvs.openbsd.org 2000/08/17 14:06:34
[session.c sshd.8 sshd.c]
sshd -u len, similar to telnetd
+ - (djm) Lastlog was not getting closed after writing login entry
20000816
- (djm) Replacement for inet_ntoa for Irix (which breaks on gcc)
/* create our struct lastlog */
lastlog_construct(li, &last);
+ if (!lastlog_openseek(li, &fd, O_RDWR|O_CREAT))
+ return(0);
+
/* write the entry */
- if (lastlog_openseek(li, &fd, O_RDWR|O_CREAT)) {
- if (atomicio(write, fd, &last, sizeof(last)) != sizeof(last)) {
- log("lastlog_write_filemode: Error writing to %s: %s",
- LASTLOG_FILE, strerror(errno));
- return 0;
- }
- return 1;
- } else {
+ if (atomicio(write, fd, &last, sizeof(last)) != sizeof(last)) {
+ close(fd);
+ log("lastlog_write_filemode: Error writing to %s: %s",
+ LASTLOG_FILE, strerror(errno));
return 0;
}
+
+ close(fd);
+ return 1;
}
int