- t = ttyslot();
- if (t > 0 && (f = open("/etc/utmp", 1)) >= 0) {
- lseek(f, (long)(t*sizeof(utmp)), 0);
- SCPYN(utmp.ut_line, rindex(ttyn, '/')+1);
- write(f, (char *)&utmp, sizeof(utmp));
- close(f);
- }
- if (t > 0 && (f = open("/usr/adm/wtmp", 1)) >= 0) {
- lseek(f, 0L, 2);
- write(f, (char *)&utmp, sizeof(utmp));
- close(f);
- }
- quietlog = access(qlog, 0) == 0;
- if ((f = open(lastlog, 2)) >= 0) {
+ SCPYN(utmp.ut_line, tty);
+ login(&utmp);
+ quietlog = access(qlog, F_OK) == 0;
+ if ((f = open(lastlog, O_RDWR)) >= 0) {