summaryrefslogtreecommitdiff
path: root/sshpty.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2001-10-12 19:15:48 +1000
committerDamien Miller <djm@mindrot.org>2001-10-12 19:15:48 +1000
commit4a820ea750ce79be709ca8c4b11edf39e07b2676 (patch)
tree3e12750b64aae8fd2f7ba8e50a0c55731a42fc10 /sshpty.c
parent7c734056f48c396fdd68ae1c441c372908b54fe9 (diff)
- (djm) Cleanup sshpty.c a little
Diffstat (limited to 'sshpty.c')
-rw-r--r--sshpty.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/sshpty.c b/sshpty.c
index f88658b80..e1e603141 100644
--- a/sshpty.c
+++ b/sshpty.c
@@ -249,17 +249,20 @@ pty_release(const char *ttyname)
249void 249void
250pty_make_controlling_tty(int *ttyfd, const char *ttyname) 250pty_make_controlling_tty(int *ttyfd, const char *ttyname)
251{ 251{
252#ifdef _CRAY
253 int fd; 252 int fd;
253#ifdef USE_VHANGUP
254 void *old;
255#endif /* USE_VHANGUP */
254 256
257#ifdef _CRAY
255 if (setsid() < 0) 258 if (setsid() < 0)
256 error("setsid: %.100s", strerror(errno)); 259 error("setsid: %.100s", strerror(errno));
257 260
258 fd = open(ttyname, O_RDWR|O_NOCTTY); 261 fd = open(ttyname, O_RDWR|O_NOCTTY);
259 if (fd != -1) { 262 if (fd != -1) {
260 signal(SIGHUP, SIG_IGN); 263 mysignal(SIGHUP, SIG_IGN);
261 ioctl(fd, TCVHUP, (char *)NULL); 264 ioctl(fd, TCVHUP, (char *)NULL);
262 signal(SIGHUP, SIG_DFL); 265 mysignal(SIGHUP, SIG_DFL);
263 setpgid(0, 0); 266 setpgid(0, 0);
264 close(fd); 267 close(fd);
265 } else { 268 } else {
@@ -273,11 +276,7 @@ pty_make_controlling_tty(int *ttyfd, const char *ttyname)
273 error("%.100s: %.100s", ttyname, strerror(errno)); 276 error("%.100s: %.100s", ttyname, strerror(errno));
274 close(*ttyfd); 277 close(*ttyfd);
275 *ttyfd = fd; 278 *ttyfd = fd;
276#else 279#else /* _CRAY */
277 int fd;
278#ifdef USE_VHANGUP
279 void *old;
280#endif /* USE_VHANGUP */
281 280
282 /* First disconnect from the old controlling tty. */ 281 /* First disconnect from the old controlling tty. */
283#ifdef TIOCNOTTY 282#ifdef TIOCNOTTY
@@ -310,9 +309,9 @@ pty_make_controlling_tty(int *ttyfd, const char *ttyname)
310 error("SETPGRP %s",strerror(errno)); 309 error("SETPGRP %s",strerror(errno));
311#endif /* HAVE_NEWS4 */ 310#endif /* HAVE_NEWS4 */
312#ifdef USE_VHANGUP 311#ifdef USE_VHANGUP
313 old = signal(SIGHUP, SIG_IGN); 312 old = mysignal(SIGHUP, SIG_IGN);
314 vhangup(); 313 vhangup();
315 signal(SIGHUP, old); 314 mysignal(SIGHUP, old);
316#endif /* USE_VHANGUP */ 315#endif /* USE_VHANGUP */
317 fd = open(ttyname, O_RDWR); 316 fd = open(ttyname, O_RDWR);
318 if (fd < 0) { 317 if (fd < 0) {
@@ -333,7 +332,7 @@ pty_make_controlling_tty(int *ttyfd, const char *ttyname)
333 else { 332 else {
334 close(fd); 333 close(fd);
335 } 334 }
336#endif 335#endif /* _CRAY */
337} 336}
338 337
339/* Changes the window size associated with the pty. */ 338/* Changes the window size associated with the pty. */