summaryrefslogtreecommitdiffstats
path: root/dirmngr/dirmngr.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2010-08-06 15:52:01 +0200
committerWerner Koch <wk@gnupg.org>2010-08-06 15:52:01 +0200
commitdc5a80930b2c18011a40f1d929119c2545cc1124 (patch)
treea74bce4e2b437331578c2ab9f1568dcecc2acf21 /dirmngr/dirmngr.c
parentSimplified http.c. (diff)
downloadgnupg2-dc5a80930b2c18011a40f1d929119c2545cc1124.tar.xz
gnupg2-dc5a80930b2c18011a40f1d929119c2545cc1124.zip
More work on the dirmngr. It now builds for W32 and W32CE and quick
tests show that it works on W32.
Diffstat (limited to 'dirmngr/dirmngr.c')
-rw-r--r--dirmngr/dirmngr.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/dirmngr/dirmngr.c b/dirmngr/dirmngr.c
index 52efb9be4..7aafc48ce 100644
--- a/dirmngr/dirmngr.c
+++ b/dirmngr/dirmngr.c
@@ -44,6 +44,7 @@
#define JNLIB_NEED_LOG_LOGV
+#define JNLIB_NEED_AFLOCAL
#include "dirmngr.h"
#include <assuan.h>
@@ -963,12 +964,17 @@ main (int argc, char **argv)
memset (&serv_addr, 0, sizeof serv_addr);
serv_addr.sun_family = AF_UNIX;
strcpy (serv_addr.sun_path, socket_name);
- len = (offsetof (struct sockaddr_un, sun_path)
- + strlen (serv_addr.sun_path) + 1);
+ len = SUN_LEN (&serv_addr);
rc = assuan_sock_bind (fd, (struct sockaddr*) &serv_addr, len);
- if (rc == -1 && errno == EADDRINUSE)
+ if (rc == -1
+ && (errno == EADDRINUSE
+#ifdef HAVE_W32_SYSTEM
+ || errno == EEXIST
+#endif
+ ))
{
+ /* Fixme: We should test whether a dirmngr is already running. */
gnupg_remove (socket_name);
rc = assuan_sock_bind (fd, (struct sockaddr*) &serv_addr, len);
}