aboutsummaryrefslogtreecommitdiffstats
path: root/src/assuan-handler.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2007-07-04 09:34:54 +0000
committerWerner Koch <[email protected]>2007-07-04 09:34:54 +0000
commit9786fe23fd24159897df32d2b18f184a1f607791 (patch)
treede1a8442c8bda7bfd37bc07f962e5b7b0ec8306e /src/assuan-handler.c
parent2007-06-15 Marcus Brinkmann <[email protected]> (diff)
downloadlibassuan-9786fe23fd24159897df32d2b18f184a1f607791.tar.gz
libassuan-9786fe23fd24159897df32d2b18f184a1f607791.zip
A couple of Changes for Windows
Diffstat (limited to 'src/assuan-handler.c')
-rw-r--r--src/assuan-handler.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/assuan-handler.c b/src/assuan-handler.c
index e7ac426..45a901c 100644
--- a/src/assuan-handler.c
+++ b/src/assuan-handler.c
@@ -509,7 +509,24 @@ process_request (assuan_context_t ctx)
{
const char *text = ctx->err_no == rc? ctx->err_str:NULL;
-#if defined(__GNUC__) && defined(__ELF__)
+#if defined(HAVE_W32_SYSTEM)
+ unsigned int source, code;
+ char ebuf[50];
+ const char *esrc;
+
+ source = ((rc >> 24) & 0xff);
+ code = (rc & 0x00ffffff);
+ if (source
+ && !_assuan_gpg_strerror_r (rc, ebuf, sizeof ebuf)
+ && (esrc=_assuan_gpg_strsource (rc)))
+ {
+ /* Assume this is an libgpg-error. */
+ sprintf (errline, "ERR %d %.50s <%.30s>%s%.100s",
+ rc, ebuf, esrc,
+ text? " - ":"", text?text:"");
+ }
+ else
+#elif defined(__GNUC__) && defined(__ELF__)
/* If we have weak symbol support we try to use the error
strings from libgpg-error without creating a dependency.
They are used for debugging purposes only, so there is no
@@ -526,7 +543,7 @@ process_request (assuan_context_t ctx)
__attribute__ ((weak));
const char *gpg_strsource (unsigned int err)
__attribute__ ((weak));
-#if !defined(HAVE_W32_SYSTEM) && __GNUC__ < 3
+#if __GNUC__ < 3
#pragma weak gpg_strerror_r
#pragma weak gpg_strsource
#endif