diff options
| author | Dag-Erling Smørgrav <des@FreeBSD.org> | 2002-04-20 12:23:04 +0000 |
|---|---|---|
| committer | Dag-Erling Smørgrav <des@FreeBSD.org> | 2002-04-20 12:23:04 +0000 |
| commit | 324e8fd88f111f37afa885df60cac16674eed9f2 (patch) | |
| tree | fcb585adcd88f5b2de91bbcf96953afab9fd2d27 | |
| parent | e8937ba00998cca6f259b3fdf32a7f7a38bc26ec (diff) | |
Notes
| -rw-r--r-- | lib/libutil/login.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/libutil/login.c b/lib/libutil/login.c index cbb60139f4629..f54ce7be76c13 100644 --- a/lib/libutil/login.c +++ b/lib/libutil/login.c @@ -44,19 +44,25 @@ static char sccsid[] = "@(#)login.c 8.1 (Berkeley) 6/4/93"; #include <sys/types.h> #include <fcntl.h> -#include <unistd.h> +#include <libutil.h> #include <stdlib.h> +#include <ttyent.h> +#include <unistd.h> #include <utmp.h> -#include <libutil.h> void login(ut) struct utmp *ut; { + struct ttyent *ty; int fd; int tty; - tty = ttyslot(); + setttyent(); + for (tty = 1; (ty = getttyent()) != NULL; ++tty) + if (strcmp(ty->ty_name, ut->ut_line) == 0) + break; + endttyent(); if (tty > 0 && (fd = open(_PATH_UTMP, O_WRONLY|O_CREAT, 0644)) >= 0) { (void)lseek(fd, (off_t)(tty * sizeof(struct utmp)), L_SET); (void)write(fd, ut, sizeof(struct utmp)); |
