mirror of
https://github.com/Stichting-MINIX-Research-Foundation/pkgsrc-ng.git
synced 2025-09-10 13:03:41 -04:00
81 lines
2.3 KiB
Plaintext
81 lines
2.3 KiB
Plaintext
$NetBSD: patch-ad,v 1.4 2005/11/03 21:34:23 rillig Exp $
|
|
|
|
--- src/Unix/sshpty.c.orig 2003-08-17 10:20:22.000000000 +0000
|
|
+++ src/Unix/sshpty.c
|
|
@@ -18,6 +18,7 @@ RCSID("$OpenBSD: sshpty.c,v 1.4 2001/12/
|
|
/* Selections from openssh's "includes.h" */
|
|
#include "config.h"
|
|
|
|
+#include <signal.h>
|
|
#include <stdio.h>
|
|
#include <ctype.h>
|
|
#include <errno.h>
|
|
@@ -145,19 +146,30 @@ pty_allocate(int *ptyfd, int *ttyfd, cha
|
|
*/
|
|
int ptm;
|
|
char *pts;
|
|
+#ifdef __sunos__
|
|
mysig_t old_signal;
|
|
-
|
|
+#else
|
|
+ sig_t old_signal;
|
|
+#endif
|
|
ptm = open("/dev/ptmx", O_RDWR | O_NOCTTY);
|
|
if (ptm < 0) {
|
|
error("/dev/ptmx: %.100s", strerror(errno));
|
|
return 0;
|
|
}
|
|
+#ifdef __sunos__
|
|
old_signal = mysignal(SIGCHLD, SIG_DFL);
|
|
+#else
|
|
+ old_signal = signal(SIGCHLD, SIG_DFL);
|
|
+#endif
|
|
if (grantpt(ptm) < 0) {
|
|
error("grantpt: %.100s", strerror(errno));
|
|
return 0;
|
|
}
|
|
+#ifdef __sunos__
|
|
mysignal(SIGCHLD, old_signal);
|
|
+#else
|
|
+ signal(SIGCHLD, old_signal);
|
|
+#endif
|
|
if (unlockpt(ptm) < 0) {
|
|
error("unlockpt: %.100s", strerror(errno));
|
|
return 0;
|
|
@@ -175,7 +187,7 @@ pty_allocate(int *ptyfd, int *ttyfd, cha
|
|
close(*ptyfd);
|
|
return 0;
|
|
}
|
|
-#ifndef HAVE_CYGWIN
|
|
+#if !defined(__NetBSD__)
|
|
/*
|
|
* Push the appropriate streams modules, as described in Solaris pts(7).
|
|
* HP-UX pts(7) doesn't have ttcompat module.
|
|
@@ -184,7 +196,7 @@ pty_allocate(int *ptyfd, int *ttyfd, cha
|
|
error("ioctl I_PUSH ptem: %.100s", strerror(errno));
|
|
if (ioctl(*ttyfd, I_PUSH, "ldterm") < 0)
|
|
error("ioctl I_PUSH ldterm: %.100s", strerror(errno));
|
|
-#ifndef __hpux
|
|
+#if !defined(__NetBSD__)
|
|
if (ioctl(*ttyfd, I_PUSH, "ttcompat") < 0)
|
|
error("ioctl I_PUSH ttcompat: %.100s", strerror(errno));
|
|
#endif
|
|
@@ -277,7 +289,7 @@ pty_allocate(int *ptyfd, int *ttyfd, cha
|
|
}
|
|
/* set tty modes to a sane state for broken clients */
|
|
if (tcgetattr(*ptyfd, &tio) < 0)
|
|
- log("Getting tty modes for pty failed: %.100s", strerror(errno));
|
|
+ error("Getting tty modes for pty failed: %.100s", strerror(errno));
|
|
else {
|
|
tio.c_lflag |= (ECHO | ISIG | ICANON);
|
|
tio.c_oflag |= (OPOST | ONLCR);
|
|
@@ -285,7 +297,7 @@ pty_allocate(int *ptyfd, int *ttyfd, cha
|
|
|
|
/* Set the new modes for the terminal. */
|
|
if (tcsetattr(*ptyfd, TCSANOW, &tio) < 0)
|
|
- log("Setting tty modes for pty failed: %.100s", strerror(errno));
|
|
+ error("Setting tty modes for pty failed: %.100s", strerror(errno));
|
|
}
|
|
|
|
return 1;
|