summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2004-12-18 11:22:10 +0100
committerWerner Koch <wk@gnupg.org>2004-12-18 11:22:10 +0100
commit3666a2859bd31115708b027cb69fa824c8111de4 (patch)
tree97d6df62972435b0b200232225553377bbcb005c /common
parent2004-12-17 Moritz Schulte <moritz@g10code.com> (diff)
downloadgnupg2-3666a2859bd31115708b027cb69fa824c8111de4.tar.xz
gnupg2-3666a2859bd31115708b027cb69fa824c8111de4.zip
Avoid the " map_to_assuan_status called with no error source" diagnostic.
Diffstat (limited to 'common')
-rw-r--r--common/ChangeLog7
-rw-r--r--common/asshelp.c16
-rw-r--r--common/asshelp.h1
-rw-r--r--common/maperror.c4
-rw-r--r--common/util.h2
5 files changed, 20 insertions, 10 deletions
diff --git a/common/ChangeLog b/common/ChangeLog
index 3115ad897..9b048ae49 100644
--- a/common/ChangeLog
+++ b/common/ChangeLog
@@ -1,3 +1,10 @@
+2004-12-18 Werner Koch <wk@g10code.com>
+
+ * maperror.c (map_assuan_err): Renamed to ..
+ (map_assuan_err_with_source): .. this and add arg SOURCE.c
+ * asshelp.c (send_pinentry_environment, send_one_option): Add arg
+ ERRSOURCE.
+
2004-12-15 Werner Koch <wk@g10code.com>
* sysutils.h [W32]: Prototypes for registry functions.
diff --git a/common/asshelp.c b/common/asshelp.c
index 243d6b9e7..efaf71e30 100644
--- a/common/asshelp.c
+++ b/common/asshelp.c
@@ -34,7 +34,8 @@
static gpg_error_t
-send_one_option (assuan_context_t ctx, const char *name, const char *value)
+send_one_option (assuan_context_t ctx, gpg_err_source_t errsource,
+ const char *name, const char *value)
{
gpg_error_t err;
char *optstr;
@@ -48,7 +49,7 @@ send_one_option (assuan_context_t ctx, const char *name, const char *value)
assuan_error_t ae;
ae = assuan_transact (ctx, optstr, NULL, NULL, NULL, NULL, NULL, NULL);
- err = ae? map_assuan_err (ae) : 0;
+ err = ae? map_assuan_err_with_source (errsource, ae) : 0;
free (optstr);
}
@@ -61,6 +62,7 @@ send_one_option (assuan_context_t ctx, const char *name, const char *value)
defaults taken from the current locale. */
gpg_error_t
send_pinentry_environment (assuan_context_t ctx,
+ gpg_err_source_t errsource,
const char *opt_display,
const char *opt_ttyname,
const char *opt_ttytype,
@@ -78,7 +80,7 @@ send_pinentry_environment (assuan_context_t ctx,
dft_display = getenv ("DISPLAY");
if (opt_display || dft_display)
{
- err = send_one_option (ctx, "display",
+ err = send_one_option (ctx, errsource, "display",
opt_display ? opt_display : dft_display);
if (err)
return err;
@@ -93,7 +95,7 @@ send_pinentry_environment (assuan_context_t ctx,
}
if (opt_ttyname || dft_ttyname)
{
- err = send_one_option (ctx, "ttyname",
+ err = send_one_option (ctx, errsource, "ttyname",
opt_ttyname ? opt_ttyname : dft_ttyname);
if (err)
return err;
@@ -103,7 +105,7 @@ send_pinentry_environment (assuan_context_t ctx,
dft_ttytype = getenv ("TERM");
if (opt_ttytype || (dft_ttyname && dft_ttytype))
{
- err = send_one_option (ctx, "ttytype",
+ err = send_one_option (ctx, errsource, "ttytype",
opt_ttyname ? opt_ttytype : dft_ttytype);
if (err)
return err;
@@ -122,7 +124,7 @@ send_pinentry_environment (assuan_context_t ctx,
#endif
if (opt_lc_ctype || (dft_ttyname && dft_lc))
{
- err = send_one_option (ctx, "lc-ctype",
+ err = send_one_option (ctx, errsource, "lc-ctype",
opt_lc_ctype ? opt_lc_ctype : dft_lc);
}
#if defined(HAVE_SETLOCALE) && defined(LC_CTYPE)
@@ -148,7 +150,7 @@ send_pinentry_environment (assuan_context_t ctx,
#endif
if (opt_lc_messages || (dft_ttyname && dft_lc))
{
- err = send_one_option (ctx, "display",
+ err = send_one_option (ctx, errsource, "display",
opt_lc_messages ? opt_lc_messages : dft_lc);
}
#if defined(HAVE_SETLOCALE) && defined(LC_MESSAGES)
diff --git a/common/asshelp.h b/common/asshelp.h
index 993594882..2d6dc79e6 100644
--- a/common/asshelp.h
+++ b/common/asshelp.h
@@ -26,6 +26,7 @@
gpg_error_t
send_pinentry_environment (assuan_context_t ctx,
+ gpg_err_source_t errsource,
const char *opt_display,
const char *opt_ttyname,
const char *opt_ttytype,
diff --git a/common/maperror.c b/common/maperror.c
index 89ecee987..91731468f 100644
--- a/common/maperror.c
+++ b/common/maperror.c
@@ -38,7 +38,7 @@
simple: All errors with a gpg_err_source of UNKNOWN are genuine
Assuan codes all others are passed verbatim through. */
gpg_error_t
-map_assuan_err (int err)
+map_assuan_err_with_source (int err, int source)
{
gpg_err_code_t ec;
@@ -77,7 +77,7 @@ map_assuan_err (int err)
ec = err < 100? GPG_ERR_ASSUAN_SERVER_FAULT : GPG_ERR_ASSUAN;
break;
}
- return gpg_err_make (GPG_ERR_SOURCE_UNKNOWN, ec);
+ return gpg_err_make (source, ec);
}
/* Map GPG_xERR_xx error codes to Assuan status codes */
diff --git a/common/util.h b/common/util.h
index 0b9357d3a..835be4e0e 100644
--- a/common/util.h
+++ b/common/util.h
@@ -61,7 +61,7 @@ typedef char gnupg_isotime_t[16];
/*-- maperror.c --*/
int map_kbx_err (int err);
-gpg_error_t map_assuan_err (int err);
+gpg_error_t map_assuan_err_with_source (int source, int err);
int map_to_assuan_status (int rc);
/*-- gettime.c --*/