aboutsummaryrefslogtreecommitdiffstats
path: root/jnlib/mischelp.h
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2009-05-19 22:39:45 +0000
committerWerner Koch <[email protected]>2009-05-19 22:39:45 +0000
commit4fa261f8ecb16fabb4d06403f6ffacaa010ce453 (patch)
treef2786955474b37c97172d5dbf932e17bc48a2543 /jnlib/mischelp.h
parentRemove testing cruft. (diff)
downloadgnupg-4fa261f8ecb16fabb4d06403f6ffacaa010ce453.tar.gz
gnupg-4fa261f8ecb16fabb4d06403f6ffacaa010ce453.zip
Fix possible system freeze on Mac OS X.
Diffstat (limited to 'jnlib/mischelp.h')
-rw-r--r--jnlib/mischelp.h32
1 files changed, 31 insertions, 1 deletions
diff --git a/jnlib/mischelp.h b/jnlib/mischelp.h
index 2f003e1ce..6bf7a9174 100644
--- a/jnlib/mischelp.h
+++ b/jnlib/mischelp.h
@@ -1,6 +1,6 @@
/* mischelp.h - Miscellaneous helper macros and functions
* Copyright (C) 1999, 2000, 2001, 2002, 2003,
- * 2006, 2007 Free Software Foundation, Inc.
+ * 2006, 2007, 2009 Free Software Foundation, Inc.
*
* This file is part of JNLIB.
*
@@ -60,5 +60,35 @@ time_t timegm (struct tm *tm);
#define wipememory(_ptr,_len) wipememory2(_ptr,0,_len)
+/* Include hacks which are mainly required for Slowaris. */
+#if defined(JNLIB_NEED_AFLOCAL) && !defined(HAVE_W32_SYSTEM)
+#include <sys/socket.h>
+#include <sys/un.h>
+
+#ifndef PF_LOCAL
+# ifdef PF_UNIX
+# define PF_LOCAL PF_UNIX
+# else
+# define PF_LOCAL AF_UNIX
+# endif
+#endif /*PF_LOCAL*/
+#ifndef AF_LOCAL
+# define AF_LOCAL AF_UNIX
+#endif /*AF_UNIX*/
+
+/* We used to avoid this macro in GnuPG and inlined the AF_LOCAL name
+ length computation directly with the little twist of adding 1 extra
+ byte. It seems that this was needed once on an old HP/UX box and
+ there are also rumours that 4.3 Reno and DEC systems need it. This
+ one-off buglet did not harm any current system until it came to Mac
+ OS X where the kernel (as of May 2009) exhibited a strange bug: The
+ systems basically froze in the connect call if the passed name
+ contained an invalid directory part. Ignore the old Unices. */
+#ifndef SUN_LEN
+# define SUN_LEN(ptr) ((size_t) (((struct sockaddr_un *) 0)->sun_path) \
+ + strlen ((ptr)->sun_path))
+#endif /*SUN_LEN*/
+#endif /*JNLIB_NEED_AFLOCAL && !HAVE_W32_SYSTEM*/
+
#endif /*LIBJNLIB_MISCHELP_H*/