From 8071a6924c12bb51406a9a64a4b2892675112c87 Mon Sep 17 00:00:00 2001 From: "djm@openbsd.org" Date: Fri, 24 Feb 2017 03:16:34 +0000 Subject: [PATCH] upstream commit might as well set the listener socket CLOEXEC Upstream-ID: 9c538433d6a0ca79f5f21decc5620e46fb68ab57 --- sshd.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sshd.c b/sshd.c index c2c1cc8a6..df694fe3d 100644 --- a/sshd.c +++ b/sshd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sshd.c,v 1.482 2017/02/06 09:22:51 djm Exp $ */ +/* $OpenBSD: sshd.c,v 1.483 2017/02/24 03:16:34 djm Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -1046,6 +1046,11 @@ server_listen(void) close(listen_sock); continue; } + if (fcntl(listen_sock, F_SETFD, FD_CLOEXEC) == -1) { + verbose("socket: CLOEXEC: %s", strerror(errno)); + close(listen_sock); + continue; + } /* * Set socket options. * Allow local port reuse in TIME_WAIT.