From 8ae68ea766f44aaeab6178f993fad74d2ff3fa1a Mon Sep 17 00:00:00 2001 From: Sam Hartman Date: Mon, 24 Jun 1996 04:16:28 +0000 Subject: [PATCH] Fix bug pointed out by jhawk; we weren't looking for all ptys on SunOS or NetBSD. Also fix Hpux 10 bug with regard to utmpx. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@8544 dc483132-0cff-0310-8789-dd5450dbe970 --- src/util/pty/ChangeLog | 12 ++++++++++++ src/util/pty/configure.in | 2 +- src/util/pty/getpty.c | 8 ++++---- src/util/pty/init_slave.c | 2 +- src/util/pty/update_wtmp.c | 6 +++--- 5 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src/util/pty/ChangeLog b/src/util/pty/ChangeLog index 104d3a648..87250edf3 100644 --- a/src/util/pty/ChangeLog +++ b/src/util/pty/ChangeLog @@ -1,7 +1,19 @@ + Thu Jun 13 22:14:24 1996 Tom Yu * configure.in: remove ref to ET_RULES + +Thu Jun 13 14:12:16 1996 Sam Hartman + + * update_wtmp.c (ptyint_update_wtmp): Only update wtmpx if we have + updwtmpx. This probably should be more general, but I'm not + really sure of HP caviats. + + * configure.in : check for updwtmpx + + * getpty.c (pty_getpty): Actually check for 256 ptys on SunOS and + other old-style systems. Tue Apr 16 22:06:36 1996 Ken Raeburn * dump-utmp.c: New file. Not automatically used by anything, but diff --git a/src/util/pty/configure.in b/src/util/pty/configure.in index 7260b6526..f64568139 100644 --- a/src/util/pty/configure.in +++ b/src/util/pty/configure.in @@ -63,7 +63,7 @@ AC_FUNC_CHECK(openpty,AC_DEFINE(HAVE_OPENPTY)) AC_FUNC_CHECK(logwtmp,AC_DEFINE(HAVE_LOGWTMP)) 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) +AC_CHECK_FUNCS(waitpid updwtmpx) DECLARE_SYS_ERRLIST KRB5_SIGTYPE CHECK_SIGNALS diff --git a/src/util/pty/getpty.c b/src/util/pty/getpty.c index 008422557..1185f2c6f 100644 --- a/src/util/pty/getpty.c +++ b/src/util/pty/getpty.c @@ -25,7 +25,7 @@ long pty_getpty (fd, slave, slavelength) int slavelength; int *fd; char *slave; { - char c; + char *cp; char *p; int i,ptynum; struct stat stb; @@ -44,7 +44,7 @@ close(slavefd); #else /*HAVE_OPENPTY*/ #ifdef HAVE__GETPTY /* This code is included for Irix; as of version 5.3, Irix has /dev/ptmx, - * but it fails to work properly; even cafter calling unlockpt, + * but it fails to work properly; even after calling unlockpt, * root gets permission denied opening the pty. * The code to support _getpty should be removed if Irix gets working * streams ptys in favor of maintaining the least needed code @@ -113,9 +113,9 @@ close(slavefd); } else { - for (c = 'p'; c <= 's'; c++) { + for (cp = "pqrstuvwxyzPQRST";*cp; cp++) { sprintf(slavebuf,"/dev/ptyXX"); - slavebuf[strlen("/dev/pty")] = c; + slavebuf[strlen("/dev/pty")] = *cp; slavebuf[strlen("/dev/ptyp")] = '0'; if (stat(slavebuf, &stb) < 0) break; diff --git a/src/util/pty/init_slave.c b/src/util/pty/init_slave.c index 09efc8d9a..74564763b 100644 --- a/src/util/pty/init_slave.c +++ b/src/util/pty/init_slave.c @@ -1,5 +1,5 @@ /* - * pty_open_slave: open slave side of terminal, clearing for use. + * pty_init_slave: open slave side of terminal, clearing for use. * * Copyright 1995, 1996 by the Massachusetts Institute of Technology. * diff --git a/src/util/pty/update_wtmp.c b/src/util/pty/update_wtmp.c index 8017b1100..c2f9461ec 100644 --- a/src/util/pty/update_wtmp.c +++ b/src/util/pty/update_wtmp.c @@ -40,7 +40,7 @@ long ptyint_update_wtmp (ent , host, user) struct utmp ut; struct stat statb; int fd; -#ifdef HAVE_SETUTXENT +#ifdef HAVE_UPDWTMPX struct utmpx utx; getutmpx(ent, &utx); @@ -54,10 +54,10 @@ long ptyint_update_wtmp (ent , host, user) #endif #ifdef HAVE_UPDWTMP -#ifndef HAVE_SETUTXENT +#ifndef HAVE_UPDWTMPX /* This is already performed byupdwtmpx if present.*/ updwtmp(WTMP_FILE, ent); -#endif /* HAVE_SETUTXENT*/ +#endif /* HAVE_UPDWTMPX*/ #else /* HAVE_UPDWTMP */ if ((fd = open(WTMP_FILE, O_WRONLY|O_APPEND, 0)) >= 0) { -- 2.26.2