From 234b6df2c9b3bf43731c86776cb7dc8953d9ea77 Mon Sep 17 00:00:00 2001 From: Ezra Peisach Date: Fri, 15 Nov 1996 13:40:31 +0000 Subject: [PATCH] * update_utmp.c (pty_update_utmp): Handle case where utmp uses ut_exit.e_exit and utmpx uses ut_exit.ut_exit. * configure.in (UT_EXIT_STRUCTURE_DIFFER): If utmpx.h exists, and getutmpx does not exist then test if the ut_exit part of the utmp/utmpx structure is a structure and if their types differ. (e_exit vs. ut_exit). git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@9422 dc483132-0cff-0310-8789-dd5450dbe970 --- src/util/pty/ChangeLog | 10 ++++++++++ src/util/pty/configure.in | 14 ++++++++++++++ src/util/pty/update_utmp.c | 4 ++++ 3 files changed, 28 insertions(+) diff --git a/src/util/pty/ChangeLog b/src/util/pty/ChangeLog index 252714063..8816ca86b 100644 --- a/src/util/pty/ChangeLog +++ b/src/util/pty/ChangeLog @@ -1,3 +1,13 @@ +Fri Nov 15 08:33:54 1996 Ezra Peisach + + * update_utmp.c (pty_update_utmp): Handle case where utmp uses + ut_exit.e_exit and utmpx uses ut_exit.ut_exit. + + * configure.in (UT_EXIT_STRUCTURE_DIFFER): If utmpx.h exists, and + getutmpx does not exist then test if the ut_exit part of + the utmp/utmpx structure is a structure and if their types + differ. (e_exit vs. ut_exit). + Fri Nov 8 17:45:42 1996 Theodore Y. Ts'o * update_utmp.c (pty_update_utmp): Add code which attempts to diff --git a/src/util/pty/configure.in b/src/util/pty/configure.in index 77d2603c7..2394debbe 100644 --- a/src/util/pty/configure.in +++ b/src/util/pty/configure.in @@ -132,6 +132,20 @@ AC_DEFINE(SETPGRP_TWOARG) fi dnl dnl +if test $ac_cv_header_utmpx_h = yes -a $ac_cv_func_getutmpx = no; then +AC_MSG_CHECKING([if utmpx and utmp ut_exit structures differ]) +AC_CACHE_VAL(krb5_cv_utmp_utmpx_diff_exit_struct, +[AC_TRY_COMPILE( +[#include +#include +#include ],[struct utmpx utx; struct utmp ut; +utx.ut_exit.ut_exit = ut.ut_exit.e_exit], +krb5_cv_utmp_utmpx_diff_exit_struct=yes, krb5_cv_utmp_utmpx_diff_exit_struct=no)]) +AC_MSG_RESULT($krb5_cv_utmp_utmpx_diff_exit_struct) +if test $krb5_cv_utmp_utmpx_diff_exit_struct = yes; then +AC_DEFINE(UT_EXIT_STRUCTURE_DIFFER) +fi +fi dnl ADD_DEF(-DKERBEROS) AC_CONST diff --git a/src/util/pty/update_utmp.c b/src/util/pty/update_utmp.c index 4e8a09c09..9effab134 100644 --- a/src/util/pty/update_utmp.c +++ b/src/util/pty/update_utmp.c @@ -135,7 +135,11 @@ long pty_update_utmp (process_type, pid, username, line, host, flags) strncpy(utx.ut_line, ent.ut_line, sizeof(ent.ut_line)); utx.ut_pid = ent.ut_pid; utx.ut_type = ent.ut_type; +#ifdef UT_EXIT_STRUCTURE_DIFFER + utx.ut_exit.ut_exit = ent.ut_exit.e_exit; +#else utx.ut_exit = ent.ut_exit; +#endif utx.ut_tv.tv_sec = ent.ut_time; utx.ut_tv.tv_usec = 0; #endif -- 2.26.2