chiark / gitweb /
dirmngr: Fix final close of LISTEN_FD.
authorNIIBE Yutaka <gniibe@fsij.org>
Tue, 18 Apr 2017 00:04:11 +0000 (09:04 +0900)
committerDaniel Kahn Gillmor <dkg@fifthhorseman.net>
Mon, 18 Sep 2017 20:41:12 +0000 (21:41 +0100)
* dirmngr/dirmngr.c (handle_connections): Close LISTEN_FD.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
(cherry picked from commit 4b2581dc0ea1d03e70023bb0748aa0c21c0a2173)

Gbp-Pq: Name 0073-dirmngr-Fix-final-close-of-LISTEN_FD.patch

dirmngr/dirmngr.c

index 31d3ca23569e144f1e78c14097723b9a7365fab3..513e2a630495f1d3e2dfa03896bc6052d40a2201 100644 (file)
@@ -1905,7 +1905,6 @@ handle_connections (assuan_fd_t listen_fd)
 #endif
   struct sockaddr_un paddr;
   socklen_t plen = sizeof( paddr );
-  gnupg_fd_t fd;
   int nfd, ret;
   fd_set fdset, read_fdset;
   int saved_errno;
@@ -2030,6 +2029,8 @@ handle_connections (assuan_fd_t listen_fd)
 
       if (FD_ISSET (FD2INT (listen_fd), &read_fdset))
        {
+          gnupg_fd_t fd;
+
           plen = sizeof paddr;
          fd = INT2FD (npth_accept (FD2INT(listen_fd),
                                    (struct sockaddr *)&paddr, &plen));
@@ -2058,7 +2059,6 @@ handle_connections (assuan_fd_t listen_fd)
                 }
              npth_setname_np (thread, threadname);
             }
-          fd = GNUPG_INVALID_FD;
        }
     }
 
@@ -2067,8 +2067,8 @@ handle_connections (assuan_fd_t listen_fd)
     close (my_inotify_fd);
 #endif /*HAVE_INOTIFY_INIT*/
   npth_attr_destroy (&tattr);
-  if (listen_fd != -1)
-    assuan_sock_close (fd);
+  if (listen_fd != GNUPG_INVALID_FD)
+    assuan_sock_close (listen_fd);
   cleanup ();
   log_info ("%s %s stopped\n", strusage(11), strusage(13));
 }