Index: trunk/src/sh_portcheck.c
===================================================================
--- trunk/src/sh_portcheck.c	(revision 333)
+++ trunk/src/sh_portcheck.c	(revision 334)
@@ -1273,8 +1273,18 @@
 	    perror(_("socket"));
 #else
-	  SH_MUTEX_LOCK(mutex_thread_nolog);
-	  sh_error_handle((-1), FIL__, __LINE__, errno, MSG_E_SUBGEN, 
-			  sh_error_message(errno, errbuf, sizeof(errbuf)), _("socket"));
-	  SH_MUTEX_UNLOCK(mutex_thread_nolog);
+
+#ifndef EPROTONOSUPPORT
+#define EPROTONOSUPPORT 0
+#endif
+#ifndef EAFNOSUPPORT
+#define EAFNOSUPPORT    0
+#endif
+	  if (errno != EPROTONOSUPPORT && errno != EAFNOSUPPORT)
+	    {
+	      SH_MUTEX_LOCK(mutex_thread_nolog);
+	      sh_error_handle((-1), FIL__, __LINE__, errno, MSG_E_SUBGEN, 
+			      sh_error_message(errno, errbuf, sizeof(errbuf)), _("socket"));
+	      SH_MUTEX_UNLOCK(mutex_thread_nolog);
+	    }
 #endif
 	  continue;
@@ -1358,8 +1368,17 @@
 	    perror(_("socket"));
 #else
-	  SH_MUTEX_LOCK(mutex_thread_nolog);
-	  sh_error_handle((-1), FIL__, __LINE__, errno, MSG_E_SUBGEN, 
-			  sh_error_message(errno, errbuf, sizeof(errbuf)), _("socket"));
-	  SH_MUTEX_UNLOCK(mutex_thread_nolog);
+#ifndef EPROTONOSUPPORT
+#define EPROTONOSUPPORT 0
+#endif
+#ifndef EAFNOSUPPORT
+#define EAFNOSUPPORT    0
+#endif
+	  if (errno != EPROTONOSUPPORT && errno != EAFNOSUPPORT)
+	    {
+	      SH_MUTEX_LOCK(mutex_thread_nolog);
+	      sh_error_handle((-1), FIL__, __LINE__, errno, MSG_E_SUBGEN, 
+			      sh_error_message(errno, errbuf, sizeof(errbuf)), _("socket"));
+	      SH_MUTEX_UNLOCK(mutex_thread_nolog);
+	    }
 #endif
 	  continue;
