+Tue Aug 8 09:13:50 1995 Sam Hartman <hartmans@pao.mit.edu>
+
+ * open_slave.c (pty_open_slave): Dissociate from controlling
+ terminal before calling revoke.
+ (pty_open_slave): Don't ask for a controlling terminal unless we need it.
+=======
Tue Aug 8 20:32:08 1995 Tom Yu <tlyu@dragons-lair.MIT.EDU>
* update_utmp.c: flush preprocessor directive to left margin.
+ * pty_err.et: Fix typo in error description.
+
+ * cleanup.c (pty_cleanup): Don't change slave before revoking it. Also return a value all the time, not just on systems without revoke.
+
-Tue Aug 8 17:24:27 EDT 1995 Paul Park (pjpark@mit.edu)
- * update_utmp.c - getutmpx() requires address of utmpx structure.
+ * update_utmp.c (pty_update_utmp): Move #ifdef back to column 1.
Mon Aug 7 17:41:39 1995 Sam Hartman <hartmans@tertius.mit.edu>
(void)chmod(slave, 0666);
(void)chown(slave, 0, 0);
-#ifndef HAVE_STREAMS
- slave[strlen("/dev/")] = 'p';
- (void)chmod(slave, 0666);
- (void)chown(slave, 0, 0);
-#endif
#ifdef HAVE_REVOKE
revoke(slave);
/*
if ( retval = ( pty_open_ctty( slave, &fd )))
return retval;
ptyint_vhangup();
- return 0;
-#endif
+#endif /*VHANG_LAST*/
+#endif /* HAVE_REVOKE*/
+#ifndef HAVE_STREAMS
+ slave[strlen("/dev/")] = 'p';
+ (void)chmod(slave, 0666);
+ (void)chown(slave, 0, 0);
#endif
+ return 0;
}
#endif
#ifdef HAVE_STREAMS
- while (ioctl (fd, I_POP, 0) == 0); /*Clear out any old lined's*/
#ifdef HAVE_LINE_PUSH
+ while (ioctl (fd, I_POP, 0) == 0); /*Clear out any old lined's*/
+
if (line_push(fd) < 0)
{
(void) close(fd); fd = -1;
return PTY_OPEN_SLAVE_LINE_PUSHFAIL;
}
#else /*No line_push */
-#ifdef sun
+#if 0 /* used to be SUN*/
if (ioctl(fd, I_PUSH, "ptem") < 0)
return PTY_OPEN_SLAVE_PUSH_FAIL;
if (ioctl(fd, I_PUSH, "ldterm") < 0)
#include "libpty.h"
#include "pty-int.h"
+
long pty_open_slave ( slave, fd)
const char *slave;
int *fd;
#endif
/* First, chmod and chown the slave*/
-if (( retval = pty_open_ctty ( slave, &vfd )) != 0 )
- return retval;
-
+ /*
+ * If we have vhangup then we really need pty_open_ctty to make sure
+ * Our controlling terminal is the pty we're opening. However, if we
+ * are using revoke or nothing then we just need a file descriiptor
+ * for the pty. Considering some OSes in this category break on
+ * the second call to open_ctty (currently OSF but others may),
+ * we simply use a descriptor if we can.
+ */
+#ifdef VHANG_FIRST
+ if (( retval = pty_open_ctty ( slave, &vfd )) != 0 )
+ return retval;
+#else /*VHANG_FIRST*/
+ if ( (vfd = open(slave, O_RDWR)) < 0 )
+ return errno;
+#endif
+
if (vfd < 0)
return PTY_OPEN_SLAVE_OPENFAIL;
#endif
(void) close(vfd);
+ if ( (retval = ptyint_void_association()) != 0)
+ return retval;
+
#ifdef HAVE_REVOKE
if (revoke (slave) < 0 ) {
return PTY_OPEN_SLAVE_REVOKEFAIL;
error_code PTY_OPEN_SLAVE_CHMODFAIL, "Failed to chmod slave side of pty"
error_code PTY_OPEN_SLAVE_NOCTTY, "Unable to set controlling terminal"
-error_code PTY_OPEN_SLAVE_CHOWNFAIL, "Failed to chown d;slave side of pty"
+error_code PTY_OPEN_SLAVE_CHOWNFAIL, "Failed to chown slave side of pty"
error_code PTY_OPEN_SLAVE_LINE_PUSHFAIL, "Call to line_push failed to push streams on slave pty"
error_code PTY_OPEN_SLAVE_PUSH_FAIL, "Failed to push stream on slave side of pty"