1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

Fix possible system freeze on Mac OS X.

This commit is contained in:
Werner Koch 2009-05-19 22:39:45 +00:00
parent 98f10d74b8
commit 4fa261f8ec
14 changed files with 73 additions and 28 deletions

View file

@ -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*/