summaryrefslogtreecommitdiff
path: root/sshpty.c
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2003-09-23 18:08:35 +0000
committerColin Watson <cjwatson@debian.org>2003-09-23 18:08:35 +0000
commitd59fd3e421aa81b8e5e118f3f806081df2aca879 (patch)
tree356a4e607edc979c625bb33db63c656d771478bd /sshpty.c
parent7505658c58e96b8d270f1928a0e1fa7f3e0c266b (diff)
parent45431c9b4677608680cd071768cbf156b316a7e8 (diff)
Merge 3.7.1p2 to the trunk. I have absolutely no idea yet whether this will
work.
Diffstat (limited to 'sshpty.c')
-rw-r--r--sshpty.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/sshpty.c b/sshpty.c
index d28947f62..4747ceaf4 100644
--- a/sshpty.c
+++ b/sshpty.c
@@ -12,7 +12,7 @@
12 */ 12 */
13 13
14#include "includes.h" 14#include "includes.h"
15RCSID("$OpenBSD: sshpty.c,v 1.8 2003/02/03 08:56:16 markus Exp $"); 15RCSID("$OpenBSD: sshpty.c,v 1.10 2003/06/12 07:57:38 markus Exp $");
16 16
17#ifdef HAVE_UTIL_H 17#ifdef HAVE_UTIL_H
18# include <util.h> 18# include <util.h>
@@ -101,12 +101,12 @@ pty_allocate(int *ptyfd, int *ttyfd, char *namebuf, int namebuflen)
101 error("/dev/ptmx: %.100s", strerror(errno)); 101 error("/dev/ptmx: %.100s", strerror(errno));
102 return 0; 102 return 0;
103 } 103 }
104 old_signal = mysignal(SIGCHLD, SIG_DFL); 104 old_signal = signal(SIGCHLD, SIG_DFL);
105 if (grantpt(ptm) < 0) { 105 if (grantpt(ptm) < 0) {
106 error("grantpt: %.100s", strerror(errno)); 106 error("grantpt: %.100s", strerror(errno));
107 return 0; 107 return 0;
108 } 108 }
109 mysignal(SIGCHLD, old_signal); 109 signal(SIGCHLD, old_signal);
110 if (unlockpt(ptm) < 0) { 110 if (unlockpt(ptm) < 0) {
111 error("unlockpt: %.100s", strerror(errno)); 111 error("unlockpt: %.100s", strerror(errno));
112 return 0; 112 return 0;
@@ -226,7 +226,7 @@ pty_allocate(int *ptyfd, int *ttyfd, char *namebuf, int namebuflen)
226 } 226 }
227 /* set tty modes to a sane state for broken clients */ 227 /* set tty modes to a sane state for broken clients */
228 if (tcgetattr(*ptyfd, &tio) < 0) 228 if (tcgetattr(*ptyfd, &tio) < 0)
229 log("Getting tty modes for pty failed: %.100s", strerror(errno)); 229 logit("Getting tty modes for pty failed: %.100s", strerror(errno));
230 else { 230 else {
231 tio.c_lflag |= (ECHO | ISIG | ICANON); 231 tio.c_lflag |= (ECHO | ISIG | ICANON);
232 tio.c_oflag |= (OPOST | ONLCR); 232 tio.c_oflag |= (OPOST | ONLCR);
@@ -234,7 +234,7 @@ pty_allocate(int *ptyfd, int *ttyfd, char *namebuf, int namebuflen)
234 234
235 /* Set the new modes for the terminal. */ 235 /* Set the new modes for the terminal. */
236 if (tcsetattr(*ptyfd, TCSANOW, &tio) < 0) 236 if (tcsetattr(*ptyfd, TCSANOW, &tio) < 0)
237 log("Setting tty modes for pty failed: %.100s", strerror(errno)); 237 logit("Setting tty modes for pty failed: %.100s", strerror(errno));
238 } 238 }
239 239
240 return 1; 240 return 1;
@@ -258,7 +258,7 @@ pty_release(const char *ttyname)
258 error("chmod %.100s 0666 failed: %.100s", ttyname, strerror(errno)); 258 error("chmod %.100s 0666 failed: %.100s", ttyname, strerror(errno));
259} 259}
260 260
261/* Makes the tty the processes controlling tty and sets it to sane modes. */ 261/* Makes the tty the process's controlling tty and sets it to sane modes. */
262 262
263void 263void
264pty_make_controlling_tty(int *ttyfd, const char *ttyname) 264pty_make_controlling_tty(int *ttyfd, const char *ttyname)
@@ -274,9 +274,9 @@ pty_make_controlling_tty(int *ttyfd, const char *ttyname)
274 274
275 fd = open(ttyname, O_RDWR|O_NOCTTY); 275 fd = open(ttyname, O_RDWR|O_NOCTTY);
276 if (fd != -1) { 276 if (fd != -1) {
277 mysignal(SIGHUP, SIG_IGN); 277 signal(SIGHUP, SIG_IGN);
278 ioctl(fd, TCVHUP, (char *)NULL); 278 ioctl(fd, TCVHUP, (char *)NULL);
279 mysignal(SIGHUP, SIG_DFL); 279 signal(SIGHUP, SIG_DFL);
280 setpgid(0, 0); 280 setpgid(0, 0);
281 close(fd); 281 close(fd);
282 } else { 282 } else {
@@ -323,9 +323,9 @@ pty_make_controlling_tty(int *ttyfd, const char *ttyname)
323 error("SETPGRP %s",strerror(errno)); 323 error("SETPGRP %s",strerror(errno));
324#endif /* HAVE_NEWS4 */ 324#endif /* HAVE_NEWS4 */
325#ifdef USE_VHANGUP 325#ifdef USE_VHANGUP
326 old = mysignal(SIGHUP, SIG_IGN); 326 old = signal(SIGHUP, SIG_IGN);
327 vhangup(); 327 vhangup();
328 mysignal(SIGHUP, old); 328 signal(SIGHUP, old);
329#endif /* USE_VHANGUP */ 329#endif /* USE_VHANGUP */
330 fd = open(ttyname, O_RDWR); 330 fd = open(ttyname, O_RDWR);
331 if (fd < 0) { 331 if (fd < 0) {
@@ -409,10 +409,10 @@ pty_setowner(struct passwd *pw, const char *ttyname)
409 if (errno == EROFS && 409 if (errno == EROFS &&
410 (st.st_mode & (S_IRGRP | S_IROTH)) == 0) 410 (st.st_mode & (S_IRGRP | S_IROTH)) == 0)
411 debug("chmod(%.100s, 0%o) failed: %.100s", 411 debug("chmod(%.100s, 0%o) failed: %.100s",
412 ttyname, mode, strerror(errno)); 412 ttyname, (u_int)mode, strerror(errno));
413 else 413 else
414 fatal("chmod(%.100s, 0%o) failed: %.100s", 414 fatal("chmod(%.100s, 0%o) failed: %.100s",
415 ttyname, mode, strerror(errno)); 415 ttyname, (u_int)mode, strerror(errno));
416 } 416 }
417 } 417 }
418} 418}