1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
$NetBSD: patch-ad,v 1.2 2004/07/17 01:56:38 xtraeme Exp $
--- sshpty.c.orig 2003-03-14 20:17:27.000000000 +0100
+++ sshpty.c 2004-07-17 03:54:38.000000000 +0200
@@ -18,6 +18,7 @@
/* Selections from openssh's "includes.h" */
#include "config.h"
+#include <signal.h>
#include <stdio.h>
#include <ctype.h>
#include <errno.h>
@@ -144,19 +145,30 @@
*/
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;
@@ -174,7 +186,7 @@
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.
@@ -183,7 +195,7 @@
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
@@ -276,7 +288,7 @@
}
/* 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);
@@ -284,7 +296,7 @@
/* 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;
|