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

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