summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2009-05-20 00:39:45 +0200
committerWerner Koch <wk@gnupg.org>2009-05-20 00:39:45 +0200
commit4fa261f8ecb16fabb4d06403f6ffacaa010ce453 (patch)
treef2786955474b37c97172d5dbf932e17bc48a2543 /tools
parentRemove testing cruft. (diff)
downloadgnupg2-4fa261f8ecb16fabb4d06403f6ffacaa010ce453.tar.xz
gnupg2-4fa261f8ecb16fabb4d06403f6ffacaa010ce453.zip
Fix possible system freeze on Mac OS X.
Diffstat (limited to 'tools')
-rw-r--r--tools/ChangeLog5
-rw-r--r--tools/sockprox.c1
-rw-r--r--tools/watchgnupg.c18
3 files changed, 10 insertions, 14 deletions
diff --git a/tools/ChangeLog b/tools/ChangeLog
index 82328eeef..bc48ef80d 100644
--- a/tools/ChangeLog
+++ b/tools/ChangeLog
@@ -1,3 +1,8 @@
+2009-05-19 Werner Koch <wk@g10code.com>
+
+ * watchgnupg.c: Include jnlib/mischelp.h if required.
+ (main): Use SUN_LEN.
+
2009-04-17 Werner Koch <wk@g10code.com>
* ccidmon.c: New.
diff --git a/tools/sockprox.c b/tools/sockprox.c
index 485b37a37..fe8d320a1 100644
--- a/tools/sockprox.c
+++ b/tools/sockprox.c
@@ -86,7 +86,6 @@ create_server_socket (const char *filename, int *new_sock)
name.sun_family = AF_LOCAL;
strncpy (name.sun_path, filename, sizeof (name.sun_path));
name.sun_path[sizeof (name.sun_path) - 1] = '\0';
-
size = SUN_LEN (&name);
remove (filename);
diff --git a/tools/watchgnupg.c b/tools/watchgnupg.c
index 213a2cb16..145a76b5e 100644
--- a/tools/watchgnupg.c
+++ b/tools/watchgnupg.c
@@ -35,7 +35,7 @@
#define PGM "watchgnupg"
-/* Allow for a standalone build. */
+/* Allow for a standalone build on most systems. */
#ifdef VERSION
#define MYVERSION_LINE PGM " (GnuPG) " VERSION
#define BUGREPORT_LINE "\nReport bugs to <bug-gnupg@gnu.org>.\n"
@@ -43,16 +43,9 @@
#define MYVERSION_LINE PGM
#define BUGREPORT_LINE ""
#endif
-
-#ifndef PF_LOCAL
-# ifdef PF_UNIX
-# define PF_LOCAL PF_UNIX
-# else
-# define PF_LOCAL AF_UNIX
-# endif
-# ifndef AF_LOCAL
-# define AF_LOCAL AF_UNIX
-# endif
+#if !defined(SUN_LEN) || !defined(PF_LOCAL) || !defined(AF_LOCAL)
+#define JNLIB_NEED_AFLOCAL
+#include "../jnlib/mischelp.h"
#endif
@@ -285,8 +278,7 @@ main (int argc, char **argv)
srvr_addr.sun_family = AF_LOCAL;
strncpy (srvr_addr.sun_path, *argv, sizeof (srvr_addr.sun_path) - 1);
srvr_addr.sun_path[sizeof (srvr_addr.sun_path) - 1] = 0;
- addrlen = (offsetof (struct sockaddr_un, sun_path)
- + strlen (srvr_addr.sun_path) + 1);
+ addrlen = SUN_LEN (&srvr_addr);
again: