From ae431b04370fe3ac3690921548d340b991eea49a Mon Sep 17 00:00:00 2001 From: NIIBE Yutaka Date: Tue, 14 Oct 2025 14:56:02 +0900 Subject: w32:common: Take care of possible race on startup under Windows. * common/asshelp.c (start_new_service) [HAVE_W32_SYSTEM]: Remove the socket before starting the daemon. -- Forward port of the 2.2 commit: 7e2133bc16f86e6d8230688f500e95fd3bdbd28c GnuPG-bug-id: 7829 Signed-off-by: NIIBE Yutaka --- common/asshelp.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'common/asshelp.c') diff --git a/common/asshelp.c b/common/asshelp.c index 0152d1243..18b88f7b9 100644 --- a/common/asshelp.c +++ b/common/asshelp.c @@ -536,6 +536,12 @@ start_new_service (assuan_context_t *r_ctx, && assuan_socket_connect (ctx, sockname, 0, connect_flags)) { #ifdef HAVE_W32_SYSTEM + /* On Windows we remove the socketname before creating it. + * This is so that we can wait for a client which is + * currently trying to connect. The 10000 will make the + * remove function wait up to 10 seconds for sharing + * violation to go away. */ + gnupg_remove_ext (sockname, 10000); err = gpgrt_process_spawn (program? program : program_name, argv, GPGRT_PROCESS_DETACHED, NULL, NULL); #else /*!W32*/ -- cgit