update_utmp.c (pty_update_utmp): Add code which attempts to compensate
authorTheodore Tso <tytso@mit.edu>
Fri, 8 Nov 1996 22:46:52 +0000 (22:46 +0000)
committerTheodore Tso <tytso@mit.edu>
Fri, 8 Nov 1996 22:46:52 +0000 (22:46 +0000)
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

src/util/pty/ChangeLog
src/util/pty/configure.in
src/util/pty/update_utmp.c

index 87250edf35dec18e848fa72107e39e58cccedb9b..252714063857086cbe71760b03966dae7b103f4b 100644 (file)
@@ -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>
 
index f64568139727d13c9d4335dd7c78a197069d3476..77d2603c7104a36884577f394ba77229ed7e6ecb 100644 (file)
@@ -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)
index 039cf6860df52e7814e97a6cee719b9cac24ac49..4e8a09c090d057093828a2b1238e97048256e7bc 100644 (file)
@@ -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