=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/ssh/sshd.c,v retrieving revision 1.476 retrieving revision 1.477 diff -u -r1.476 -r1.477 --- src/usr.bin/ssh/sshd.c 2016/09/28 16:33:07 1.476 +++ src/usr.bin/ssh/sshd.c 2016/11/29 03:54:50 1.477 @@ -1,4 +1,4 @@ -/* $OpenBSD: sshd.c,v 1.476 2016/09/28 16:33:07 djm Exp $ */ +/* $OpenBSD: sshd.c,v 1.477 2016/11/29 03:54:50 dtucker Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -105,10 +105,6 @@ #include "version.h" #include "ssherr.h" -#ifndef O_NOCTTY -#define O_NOCTTY 0 -#endif - /* Re-exec fds */ #define REEXEC_DEVCRYPTO_RESERVED_FD (STDERR_FILENO + 1) #define REEXEC_STARTUP_PIPE_FD (STDERR_FILENO + 2) @@ -1673,17 +1669,11 @@ * exits. */ if (!(debug_flag || inetd_flag || no_daemon_flag)) { - int fd; if (daemon(0, 0) < 0) fatal("daemon() failed: %.200s", strerror(errno)); - /* Disconnect from the controlling tty. */ - fd = open(_PATH_TTY, O_RDWR | O_NOCTTY); - if (fd >= 0) { - (void) ioctl(fd, TIOCNOTTY, NULL); - close(fd); - } + disconnect_controlling_tty(); } /* Reinitialize the log (because of the fork above). */ log_init(__progname, options.log_level, options.log_facility, log_stderr);