Blame SOURCES/0001-Move-closing-standard-FDs-after-listen.patch

ab00cd
From 40fea4552377504ce69935149e64e39a595f4600 Mon Sep 17 00:00:00 2001
ab00cd
From: =?UTF-8?q?Ond=C5=99ej=20Lyson=C4=9Bk?= <olysonek@redhat.com>
ab00cd
Date: Sat, 3 Aug 2019 17:50:14 +0200
ab00cd
Subject: [PATCH 1/2] Move closing standard FDs after listen()
ab00cd
ab00cd
The vsf_sysutil_close() calls need to be moved a bit further so that
ab00cd
die() works properly in case listen() fails.
ab00cd
ab00cd
I see no reason the calls should be placed before listen()
ab00cd
specifically, as they are now. My guess is that the author who added
ab00cd
the calls thought that listen() is a blocking call, which is not the
ab00cd
case. The only thing we need to satisfy is that close() is called
ab00cd
before accept, because that is a blocking call. That's all that is
ab00cd
needed to fix the bug that was fixed by adding the close() calls.
ab00cd
ab00cd
Resolves: rhbz#1666380
ab00cd
---
ab00cd
 standalone.c | 6 +++---
ab00cd
 1 file changed, 3 insertions(+), 3 deletions(-)
ab00cd
ab00cd
diff --git a/standalone.c b/standalone.c
ab00cd
index 3f35e9e..b358ca1 100644
ab00cd
--- a/standalone.c
ab00cd
+++ b/standalone.c
ab00cd
@@ -152,15 +152,15 @@ vsf_standalone_main(void)
ab00cd
       vsf_sysutil_kill(vsf_sysutil_getppid(), kVSFSysUtilSigUSR1);
ab00cd
     }
ab00cd
   }
ab00cd
-  vsf_sysutil_close(0);
ab00cd
-  vsf_sysutil_close(1);
ab00cd
-  vsf_sysutil_close(2);
ab00cd
   retval = vsf_sysutil_listen(listen_sock, VSFTP_LISTEN_BACKLOG);
ab00cd
   if (vsf_sysutil_retval_is_error(retval))
ab00cd
   {
ab00cd
     die("could not listen");
ab00cd
   }
ab00cd
   vsf_sysutil_sockaddr_alloc(&p_accept_addr);
ab00cd
+  vsf_sysutil_close(0);
ab00cd
+  vsf_sysutil_close(1);
ab00cd
+  vsf_sysutil_close(2);
ab00cd
   while (1)
ab00cd
   {
ab00cd
     struct vsf_client_launch child_info;
ab00cd
-- 
ab00cd
2.20.1
ab00cd