=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/ssh/sshpty.c,v retrieving revision 1.30 retrieving revision 1.31 diff -u -r1.30 -r1.31 --- src/usr.bin/ssh/sshpty.c 2015/07/30 23:09:15 1.30 +++ src/usr.bin/ssh/sshpty.c 2016/11/29 03:54:50 1.31 @@ -1,4 +1,4 @@ -/* $OpenBSD: sshpty.c,v 1.30 2015/07/30 23:09:15 djm Exp $ */ +/* $OpenBSD: sshpty.c,v 1.31 2016/11/29 03:54:50 dtucker Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -177,5 +177,17 @@ fatal("chmod(%.100s, 0%o) failed: %.100s", tty, (u_int)mode, strerror(errno)); } + } +} + +/* Disconnect from the controlling tty. */ +void +disconnect_controlling_tty(void) +{ + int fd; + + if ((fd = open(_PATH_TTY, O_RDWR | O_NOCTTY)) >= 0) { + (void) ioctl(fd, TIOCNOTTY, NULL); + close(fd); } }