From 9786fe23fd24159897df32d2b18f184a1f607791 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Wed, 4 Jul 2007 09:34:54 +0000 Subject: A couple of Changes for Windows --- src/assuan-handler.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'src/assuan-handler.c') 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 -- cgit v1.2.3