[svn] gpg-error - r216 - in trunk: . src
svn author marcus
cvs at cvs.gnupg.org
Fri Jul 17 03:53:20 CEST 2009
Author: marcus
Date: 2009-07-17 03:53:19 +0200 (Fri, 17 Jul 2009)
New Revision: 216
Modified:
trunk/ChangeLog
trunk/README
trunk/src/mkerrnos.awk
Log:
2009-07-17 Marcus Brinkmann <marcus at g10code.de>
* src/mkerrnos.awk: Output code to cause WSA Errors to be found
from gpg error codes.
* README: Add problem of translating error codes back and forth.
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2009-07-17 01:37:42 UTC (rev 215)
+++ trunk/ChangeLog 2009-07-17 01:53:19 UTC (rev 216)
@@ -1,5 +1,9 @@
2009-07-17 Marcus Brinkmann <marcus at g10code.de>
+ * src/mkerrnos.awk: Output code to cause WSA Errors to be found
+ from gpg error codes.
+ * README: Add problem of translating error codes back and forth.
+
* src/mkerrcodes1.awk: Output code to cause WSA Errors to be
transparently translated.
* src/code-from-errno.c [HAVE_W32_SYSTEM]: Don't include winsock2.h.
Modified: trunk/README
===================================================================
--- trunk/README 2009-07-17 01:37:42 UTC (rev 215)
+++ trunk/README 2009-07-17 01:53:19 UTC (rev 216)
@@ -81,10 +81,22 @@
On Windows, WSA Error Codes can be provided as system error codes and
will be transparently converted to the corresponding gpg error codes.
-However, not all of them have detailed description when printed with
-gpg_strerror, but will default to "Unknown system error (NUMBER)" for
-pretty printing. For example, WSAEHOSTDOWN will be translated to
-GPG_ERR_EHOSTDOWN, but there is no corresponding EHOSTDOWN in Windows
-and thus gpg_strerror will default to "Unknown system error (8029)".
-(This could be fixed by adding our own error strings replacing or
-extending the system error strings, including their translations).
+There are two problems with this support:
+
+* Not all error codes corresponding to WSA Error codes have a detailed
+ description when printed with gpg_strerror. Some will default to
+ "Unknown error" for pretty printing. For example, WSAEHOSTDOWN will
+ be translated to GPG_ERR_EHOSTDOWN, but there is no corresponding
+ EHOSTDOWN in Windows and thus gpg_strerror will default to "Unknown
+ error" as printed by the system's strerror function for the argument
+ WSAEHOSTDOWN. (This could be fixed by adding our own error strings
+ replacing or extending the system error strings, including their
+ translations).
+
+* The translation to a gpg error code and back to a system error code
+ in some cases does not preserve information. For example, the error code
+ WSAEACCES translates to GPG_ERR_EACCES, which translates back to
+ EACCES.
+
+Any WSA Error code has either the first problem or the second (but not
+both), depending on if there is a corresponding Windows error code.
Modified: trunk/src/mkerrnos.awk
===================================================================
--- trunk/src/mkerrnos.awk 2009-07-17 01:37:42 UTC (rev 215)
+++ trunk/src/mkerrnos.awk 2009-07-17 01:53:19 UTC (rev 216)
@@ -71,6 +71,9 @@
if ($1 ~ /^[0-9]/)
{
print "#include <errno.h>";
+ print "#ifdef _WIN32";
+ print "#include <winsock2.h>";
+ print "#endif";
print "";
print "static const int err_code_to_errno [] = {";
header = 0;
@@ -89,8 +92,12 @@
print "#ifdef " $errnoidx;
print " " $errnoidx ",";
print "#else";
+ print "#ifdef WSA" $errnoidx;
+ print " WSA" $errnoidx ",";
+ print "#else";
print " 0,";
print "#endif";
+ print "#endif";
}
END {
print "};";
More information about the Gnupg-commits
mailing list