From 337f6ec174e59ad7a6f221ad789f38c8aca08cc0 Mon Sep 17 00:00:00 2001 From: Mark Eichin Date: Fri, 24 Mar 1995 01:28:24 +0000 Subject: [PATCH] * logutil.c (update_wtmp): initialize ut from ent the way the V4 code did. Appears to handle SunOS case (when nearly all of the ifdef's are off) correctly now. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@5207 dc483132-0cff-0310-8789-dd5450dbe970 --- src/appl/bsd/ChangeLog | 6 ++++++ src/appl/bsd/logutil.c | 16 ++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/src/appl/bsd/ChangeLog b/src/appl/bsd/ChangeLog index a4d3899cb..9f38f19bf 100644 --- a/src/appl/bsd/ChangeLog +++ b/src/appl/bsd/ChangeLog @@ -1,3 +1,9 @@ +Thu Mar 23 20:22:57 1995 Mark Eichin + + * logutil.c (update_wtmp): initialize ut from ent the way the V4 + code did. Appears to handle SunOS case (when nearly all of the + ifdef's are off) correctly now. + Tue Mar 14 16:08:08 1995 * Makefile.in, configure.in: Use the libdes425 library so that the diff --git a/src/appl/bsd/logutil.c b/src/appl/bsd/logutil.c index 1f22083f2..70dd6588d 100644 --- a/src/appl/bsd/logutil.c +++ b/src/appl/bsd/logutil.c @@ -164,6 +164,22 @@ void update_wtmp(ent) if ((fd = open(WTMP_FILE, O_WRONLY|O_APPEND, 0)) >= 0) { if (!fstat(fd, &statb)) { + (void)memset((char *)&ut, 0, sizeof(ut)); + (void)strncpy(ut.ut_line, ent->ut_line, sizeof(ut.ut_line)); + (void)strncpy(ut.ut_name, ent->ut_name, sizeof(ut.ut_name)); +#ifndef NO_UT_HOST + (void)strncpy(ut.ut_host, ent->ut_host, sizeof(ut.ut_host)); +#endif + (void)time(&ut.ut_time); +#ifdef HAVE_GETUTENT + if (*name) { + if (!ut.ut_pid) + ut.ut_pid = getpid(); + ut.ut_type = USER_PROCESS; + } else { + ut.ut_type = EMPTY; + } +#endif if (write(fd, (char *)&ut, sizeof(struct utmp)) != sizeof(struct utmp)) (void)ftruncate(fd, statb.st_size); -- 2.26.2