diff options
author | dtucker@openbsd.org <dtucker@openbsd.org> | 2016-11-29 04:54:50 +0100 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2016-11-29 06:51:27 +0100 |
commit | b0899ee26a6630883c0f2350098b6a35e647f512 (patch) | |
tree | 9869e87c60d4458dfc1776542c5f5c7c5ad81464 /sshpty.c | |
parent | upstream commit (diff) | |
download | openssh-b0899ee26a6630883c0f2350098b6a35e647f512.tar.xz openssh-b0899ee26a6630883c0f2350098b6a35e647f512.zip |
upstream commit
Factor out code to disconnect from controlling terminal
into its own function. ok djm@
Upstream-ID: 39fd9e8ebd7222615a837312face5cc7ae962885
Diffstat (limited to 'sshpty.c')
-rw-r--r-- | sshpty.c | 16 |
1 files changed, 15 insertions, 1 deletions
@@ -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 <ylo@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland @@ -238,3 +238,17 @@ pty_setowner(struct passwd *pw, const char *tty) } } } + +/* Disconnect from the controlling tty. */ +void +disconnect_controlling_tty(void) +{ +#ifdef TIOCNOTTY + int fd; + + if ((fd = open(_PATH_TTY, O_RDWR | O_NOCTTY)) >= 0) { + (void) ioctl(fd, TIOCNOTTY, NULL); + close(fd); + } +#endif /* TIOCNOTTY */ +} |