[openssh-commits] [openssh] 01/03: upstream: disconnect_controlling_tty() is the only thing from sshpty.c

git+noreply at mindrot.org git+noreply at mindrot.org
Tue Sep 15 16:59:19 AEST 2026


This is an automated email from the git hooks/post-receive script.

djm pushed a commit to branch master
in repository openssh.

commit a7f490e1e3d758df1ccd42a70f2ca47d7a09fe89
Author: djm at openbsd.org <djm at openbsd.org>
AuthorDate: Tue Sep 15 06:30:58 2026 +0000

    upstream: disconnect_controlling_tty() is the only thing from sshpty.c
    
    used in sshd, and sshd is the only thing that calls this function.
    
    Move it into sshd.c and we no longer need to compile sshd against
    sshpty.c
    
    Part of bz3996 from Colin Watson
    
    OpenBSD-Commit-ID: cbfb0ecba5c63852d33e930d01f00586ce15ad1d
---
 sshd.c   | 17 +++++++++++++++++
 sshpty.c | 20 +-------------------
 2 files changed, 18 insertions(+), 19 deletions(-)

diff --git a/sshd.c b/sshd.c
index 10c0da3b3..f264cf7e6 100644
--- a/sshd.c
+++ b/sshd.c
@@ -1272,6 +1272,23 @@ prepare_proctitle(int ac, char **av)
 	return ret;
 }
 
+/* Disconnect from the controlling tty. */
+void
+disconnect_controlling_tty(void)
+{
+#ifdef TIOCNOTTY
+# ifndef O_NOCTTY
+#  define O_NOCTTY 0
+# endif
+	int fd;
+
+	if ((fd = open(_PATH_TTY, O_RDWR | O_NOCTTY)) >= 0) {
+		(void) ioctl(fd, TIOCNOTTY, NULL);
+		close(fd);
+	}
+#endif /* TIOCNOTTY */
+}
+
 static void
 print_config(struct connection_info *connection_info)
 {
diff --git a/sshpty.c b/sshpty.c
index b3e1e2466..f8102604c 100644
--- a/sshpty.c
+++ b/sshpty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshpty.c,v 1.35 2026/02/11 17:05:32 dtucker Exp $ */
+/* $OpenBSD: sshpty.c,v 1.36 2026/09/15 06:30:58 djm Exp $ */
 /*
  * Author: Tatu Ylonen <ylo at cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo at cs.hut.fi>, Espoo, Finland
@@ -39,10 +39,6 @@
 # include <pty.h>
 #endif
 
-#ifndef O_NOCTTY
-#define O_NOCTTY 0
-#endif
-
 #ifdef __APPLE__
 # include <AvailabilityMacros.h>
 # if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
@@ -212,17 +208,3 @@ 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 */
-}

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list