diff options
author | Dag-Erling Smørgrav <des@FreeBSD.org> | 2017-01-31 12:33:47 +0000 |
---|---|---|
committer | Dag-Erling Smørgrav <des@FreeBSD.org> | 2017-01-31 12:33:47 +0000 |
commit | 19ca85510bbe080af3faf5e9ae394608428ac953 (patch) | |
tree | 117f9a26f0d949b937129ea841578bd2ba4390fa /sshpty.c | |
parent | ab4ec008e7abd1c8098428dbf9642c3685383045 (diff) | |
download | src-19ca85510bbe080af3faf5e9ae394608428ac953.tar.gz src-19ca85510bbe080af3faf5e9ae394608428ac953.zip |
Vendor import of OpenSSH 7.4p1.vendor/openssh/7.4p1
Notes
Notes:
svn path=/vendor-crypto/openssh/dist/; revision=313012
svn path=/vendor-crypto/openssh/7.4p1/; revision=313013; tag=vendor/openssh/7.4p1
Diffstat (limited to 'sshpty.c')
-rw-r--r-- | sshpty.c | 22 |
1 files changed, 18 insertions, 4 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 @@ -155,11 +155,11 @@ pty_make_controlling_tty(int *ttyfd, const char *tty) error("SETPGRP %s",strerror(errno)); #endif /* NEED_SETPGRP */ fd = open(tty, O_RDWR); - if (fd < 0) { + if (fd < 0) error("%.100s: %.100s", tty, strerror(errno)); - } else { + else close(fd); - } + /* Verify that we now have a controlling tty. */ fd = open(_PATH_TTY, O_WRONLY); if (fd < 0) @@ -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 */ +} |