From 0a4e27d5832a6a2d0fdaff4a169d0c216b37eeee Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Sun, 18 Feb 2001 12:36:39 +1100 Subject: [PATCH] - (djm) Close listen_sock on bind() failures. Patch from Arkadiusz Miskiewicz --- ChangeLog | 4 +++- sshd.c | 8 ++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 404423a5c..4450f48ac 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,8 @@ stevesk - (djm) Fix my breaking of cygwin builds, Patch from Corinna Vinschen and myself. + - (djm) Close listen_sock on bind() failures. Patch from Arkadiusz + Miskiewicz 20010217 - (bal) OpenBSD Sync: @@ -4012,4 +4014,4 @@ - Wrote replacements for strlcpy and mkdtemp - Released 1.0pre1 -$Id: ChangeLog,v 1.785 2001/02/18 01:30:55 djm Exp $ +$Id: ChangeLog,v 1.786 2001/02/18 01:36:39 djm Exp $ diff --git a/sshd.c b/sshd.c index 86bfb6519..be046ea65 100644 --- a/sshd.c +++ b/sshd.c @@ -849,10 +849,10 @@ main(int ac, char **av) debug("Bind to port %s on %s.", strport, ntop); /* Bind the socket to the desired port. */ - if ((bind(listen_sock, ai->ai_addr, ai->ai_addrlen) < 0) && - (!ai->ai_next)) { - error("Bind to port %s on %s failed: %.200s.", - strport, ntop, strerror(errno)); + if (bind(listen_sock, ai->ai_addr, ai->ai_addrlen) < 0) { + if (!ai->ai_next) + error("Bind to port %s on %s failed: %.200s.", + strport, ntop, strerror(errno)); close(listen_sock); continue; }