summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTheodore Tso <tytso@mit.edu>1996-11-08 22:46:52 +0000
committerTheodore Tso <tytso@mit.edu>1996-11-08 22:46:52 +0000
commit1a430a283080b4d41084b3fc8b735c2eb79b6a68 (patch)
tree11e38fc165fac2338966854cd4f119a94855bb17 /src
parentacbfa341cec15cbf41dff5ab54a901176b4984fb (diff)
update_utmp.c (pty_update_utmp): Add code which attempts to compensate
for systems that don't have getutmpx() configure.in: Check for getutmpx(). Replace calls to AC_FUNC_CHECK with AC_HAVE_FUNCS(). git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@9349 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src')
-rw-r--r--src/util/pty/ChangeLog7
-rw-r--r--src/util/pty/configure.in11
-rw-r--r--src/util/pty/update_utmp.c12
3 files changed, 20 insertions, 10 deletions
diff --git a/src/util/pty/ChangeLog b/src/util/pty/ChangeLog
index 87250edf3..252714063 100644
--- a/src/util/pty/ChangeLog
+++ b/src/util/pty/ChangeLog
@@ -1,3 +1,10 @@
+Fri Nov 8 17:45:42 1996 Theodore Y. Ts'o <tytso@mit.edu>
+
+ * update_utmp.c (pty_update_utmp): Add code which attempts to
+ compensate for systems that don't have getutmpx()
+
+ * configure.in: Check for getutmpx(). Replace calls to
+ AC_FUNC_CHECK with AC_HAVE_FUNCS().
Thu Jun 13 22:14:24 1996 Tom Yu <tlyu@voltage-multiplier.mit.edu>
diff --git a/src/util/pty/configure.in b/src/util/pty/configure.in
index f64568139..77d2603c7 100644
--- a/src/util/pty/configure.in
+++ b/src/util/pty/configure.in
@@ -51,16 +51,7 @@ AC_SUBST(LOGINLIBS)
dnl
AC_TYPE_MODE_T
AC_FUNC_CHECK(strsave,AC_DEFINE(HAS_STRSAVE))
-AC_FUNC_CHECK(getutent,AC_DEFINE(HAVE_GETUTENT))
-AC_FUNC_CHECK(setreuid,AC_DEFINE(HAVE_SETREUID))
-AC_FUNC_CHECK(gettosbyname,AC_DEFINE(HAVE_GETTOSBYNAME))
-AC_FUNC_CHECK(setsid,AC_DEFINE(HAVE_SETSID))
-AC_FUNC_CHECK(ttyname,AC_DEFINE(HAVE_TTYNAME))
-AC_FUNC_CHECK(line_push,AC_DEFINE(HAVE_LINE_PUSH))
-AC_FUNC_CHECK(ptsname,AC_DEFINE(HAVE_PTSNAME))
-AC_FUNC_CHECK(grantpt,AC_DEFINE(HAVE_GRANTPT))
-AC_FUNC_CHECK(openpty,AC_DEFINE(HAVE_OPENPTY))
-AC_FUNC_CHECK(logwtmp,AC_DEFINE(HAVE_LOGWTMP))
+AC_HAVE_FUNCS(getutent setreuid gettosbyname setsid ttyname line_push ptsname grantpt openpty logwtmp getutmpx)
AC_CHECK_HEADERS(unistd.h stdlib.h string.h utmpx.h utmp.h sys/filio.h sys/sockio.h sys/label.h sys/tty.h ttyent.h lastlog.h sys/select.h sys/ptyvar.h)
AC_CHECK_HEADERS(sys/wait.h)
AC_CHECK_FUNCS(waitpid updwtmpx)
diff --git a/src/util/pty/update_utmp.c b/src/util/pty/update_utmp.c
index 039cf6860..4e8a09c09 100644
--- a/src/util/pty/update_utmp.c
+++ b/src/util/pty/update_utmp.c
@@ -126,7 +126,19 @@ long pty_update_utmp (process_type, pid, username, line, host, flags)
#ifdef HAVE_SETUTXENT
setutxent();
+#ifdef HAVE_GETUTMPX
getutmpx(&ent, &utx);
+#else
+ /* For platforms like HPUX and Dec Unix which don't have getutmpx */
+ strncpy(utx.ut_user, ent.ut_user, sizeof(ent.ut_user));
+ strncpy(utx.ut_id, ent.ut_id, sizeof(ent.ut_id));
+ strncpy(utx.ut_line, ent.ut_line, sizeof(ent.ut_line));
+ utx.ut_pid = ent.ut_pid;
+ utx.ut_type = ent.ut_type;
+ utx.ut_exit = ent.ut_exit;
+ utx.ut_tv.tv_sec = ent.ut_time;
+ utx.ut_tv.tv_usec = 0;
+#endif
if (host)
strncpy(utx.ut_host, host, sizeof(utx.ut_host));
else