[svn] gpg-error - r194 - in trunk: . src

svn author wk cvs at cvs.gnupg.org
Wed Jun 27 21:59:30 CEST 2007


Author: wk
Date: 2007-06-27 21:59:00 +0200 (Wed, 27 Jun 2007)
New Revision: 194

Modified:
   trunk/ChangeLog
   trunk/src/code-from-errno.c
   trunk/src/gpg-error.m4
Log:
Minor W32 enhancements


Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2007-05-19 22:01:45 UTC (rev 193)
+++ trunk/ChangeLog	2007-06-27 19:59:00 UTC (rev 194)
@@ -3,6 +3,16 @@
 	* lang/cl/gpg-error.lisp (gpg-err-source-t): Add
 	:gpg-err-source-any.
 
+2007-06-18  Werner Koch  <wk at g10code.com>
+
+	* src/code-from-errno.c (w32_special_errnos) [W32]: New.  This is
+	to provide some common mappings for winsocket error codes.
+	(gpg_err_code_from_errno, gpg_err_code_from_syserror): Use it.
+
+2007-05-09  Werner Koch  <wk at g10code.com>
+
+	* src/gpg-error.m4: Print found version on success.
+
 2006-12-09  Marcus Brinkmann  <marcus at g10code.de>
 
 	* src/Makefile.am (EXTRA_DIST): Add README.

Modified: trunk/src/code-from-errno.c
===================================================================
--- trunk/src/code-from-errno.c	2007-05-19 22:01:45 UTC (rev 193)
+++ trunk/src/code-from-errno.c	2007-06-27 19:59:00 UTC (rev 194)
@@ -23,11 +23,37 @@
 #endif
 
 #include <errno.h> 
+#ifdef HAVE_W32_SYSTEM
+#include <winsock2.h>
+#endif
 
 #include <gpg-error.h>
 
 #include "code-from-errno.h"
 
+#ifdef HAVE_W32_SYSTEM
+/* Under Windows socket related error codes are defined in a different
+   file and prefixed with "WSA".  As their ranges don't overlap, we map
+   some of them to our usual error codes. */
+gpg_err_code_t
+w32_special_errnos (int err)
+{
+  switch (err)
+    {
+    case WSAEADDRINUSE:    return GPG_ERR_EADDRINUSE;
+    case WSAEADDRNOTAVAIL: return GPG_ERR_EADDRNOTAVAIL;  
+    case WSAECONNABORTED:  return GPG_ERR_ECONNABORTED;
+    case WSAECONNREFUSED:  return GPG_ERR_ECONNREFUSED;
+    case WSAECONNRESET:    return GPG_ERR_ECONNRESET;
+    case WSAENAMETOOLONG:  return GPG_ERR_ENAMETOOLONG;
+    case WSAEHOSTDOWN:     return GPG_ERR_EHOSTDOWN;
+    case WSAEHOSTUNREACH:  return GPG_ERR_EHOSTUNREACH;
+    default: 
+      return GPG_ERR_UNKNOWN_ERRNO;
+    }
+}
+#endif /*HAVE_W32_SYSTEM*/
+
 /* Retrieve the error code for the system error ERR.  This returns
    GPG_ERR_UNKNOWN_ERRNO if the system error is not mapped (report
    this).  */
@@ -42,7 +68,13 @@
   idx = errno_to_idx (err);
 
   if (idx < 0)
-    return GPG_ERR_UNKNOWN_ERRNO;
+    {
+#ifdef HAVE_W32_SYSTEM
+      return w32_special_errnos (err);
+#else
+      return GPG_ERR_UNKNOWN_ERRNO;
+#endif
+    }
 
   return GPG_ERR_SYSTEM_ERROR | err_code_from_index[idx];
 }
@@ -63,7 +95,13 @@
   idx = errno_to_idx (err);
 
   if (idx < 0)
-    return GPG_ERR_UNKNOWN_ERRNO;
+    {
+#ifdef HAVE_W32_SYSTEM
+      return w32_special_errnos (err);
+#else
+      return GPG_ERR_UNKNOWN_ERRNO;
+#endif
+    }
 
   return GPG_ERR_SYSTEM_ERROR | err_code_from_index[idx];
 }

Modified: trunk/src/gpg-error.m4
===================================================================
--- trunk/src/gpg-error.m4	2007-05-19 22:01:45 UTC (rev 193)
+++ trunk/src/gpg-error.m4	2007-06-27 19:59:00 UTC (rev 194)
@@ -51,7 +51,7 @@
   if test $ok = yes; then
     GPG_ERROR_CFLAGS=`$GPG_ERROR_CONFIG $gpg_error_config_args --cflags`
     GPG_ERROR_LIBS=`$GPG_ERROR_CONFIG $gpg_error_config_args --libs`
-    AC_MSG_RESULT(yes)
+    AC_MSG_RESULT([yes ($gpg_error_config_version)])
     ifelse([$2], , :, [$2])
   else
     GPG_ERROR_CFLAGS=""




More information about the Gnupg-commits mailing list