aboutsummaryrefslogtreecommitdiffstats
path: root/common/asshelp.c
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2025-10-14 05:56:02 +0000
committerNIIBE Yutaka <[email protected]>2025-10-21 04:17:50 +0000
commitae431b04370fe3ac3690921548d340b991eea49a (patch)
tree2939d1b40e638da5ed65534e760774e0d0405286 /common/asshelp.c
parentcommon: New function gnupg_remove_ext. (diff)
downloadgnupg-ae431b04370fe3ac3690921548d340b991eea49a.tar.gz
gnupg-ae431b04370fe3ac3690921548d340b991eea49a.zip
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 <[email protected]>
Diffstat (limited to 'common/asshelp.c')
-rw-r--r--common/asshelp.c6
1 files changed, 6 insertions, 0 deletions
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*/