aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2002-08-20 05:10:34 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2002-08-20 05:10:34 +0800
commit4eb2dbe2e64d3f25f11ce1a0534e32c87229f9d7 (patch)
tree0226d7c0c41b6650aabeffa1fb6b3441c1af3222
parent069c1918f0519758a66e067d0734cb0a1ec32518 (diff)
downloadgsoc2013-evolution-4eb2dbe2e64d3f25f11ce1a0534e32c87229f9d7.tar
gsoc2013-evolution-4eb2dbe2e64d3f25f11ce1a0534e32c87229f9d7.tar.gz
gsoc2013-evolution-4eb2dbe2e64d3f25f11ce1a0534e32c87229f9d7.tar.bz2
gsoc2013-evolution-4eb2dbe2e64d3f25f11ce1a0534e32c87229f9d7.tar.lz
gsoc2013-evolution-4eb2dbe2e64d3f25f11ce1a0534e32c87229f9d7.tar.xz
gsoc2013-evolution-4eb2dbe2e64d3f25f11ce1a0534e32c87229f9d7.tar.zst
gsoc2013-evolution-4eb2dbe2e64d3f25f11ce1a0534e32c87229f9d7.zip
If the diagnostics are empty, just explain that gpg failed to execute.
2002-08-19 Jeffrey Stedfast <fejj@ximian.com> * camel-gpg-context.c (gpg_sign): If the diagnostics are empty, just explain that gpg failed to execute. (gpg_encrypt): Same. (gpg_decrypt): And here too. svn path=/trunk/; revision=17807
-rw-r--r--camel/ChangeLog5
-rw-r--r--camel/camel-gpg-context.c26
2 files changed, 25 insertions, 6 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 2c0cb7f432..a857f41559 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,5 +1,10 @@
2002-08-19 Jeffrey Stedfast <fejj@ximian.com>
+ * camel-gpg-context.c (gpg_sign): If the diagnostics are empty,
+ just explain that gpg failed to execute.
+ (gpg_encrypt): Same.
+ (gpg_decrypt): And here too.
+
* tests/lib/camel-test.c (camel_test_init): Updated to pass the
needed arguments to camel_init() and to init gthreads before camel
(since camel expectes it to be initialised already).
diff --git a/camel/camel-gpg-context.c b/camel/camel-gpg-context.c
index 290f921eaf..9b586e5f9b 100644
--- a/camel/camel-gpg-context.c
+++ b/camel/camel-gpg-context.c
@@ -566,12 +566,16 @@ static int
gpg_ctx_op_start (struct _GpgCtx *gpg)
{
char *status_fd = NULL, *passwd_fd = NULL;
- int i, maxfd, fds[10];
+ int i, maxfd, errnosave, fds[10];
GPtrArray *argv;
+ struct stat st;
for (i = 0; i < 10; i++)
fds[i] = -1;
+ if (stat (gpg->path, &st) == -1)
+ goto exception;
+
maxfd = gpg->need_passwd ? 10 : 8;
for (i = 0; i < maxfd; i += 2) {
if (pipe (fds + i) == -1)
@@ -645,11 +649,15 @@ gpg_ctx_op_start (struct _GpgCtx *gpg)
exception:
+ errnosave = errno;
+
for (i = 0; i < 10; i++) {
if (fds[i] != -1)
close (fds[i]);
}
+ errno = errnosave;
+
return -1;
}
@@ -1207,8 +1215,8 @@ gpg_sign (CamelCipherContext *context, const char *userid, CamelCipherHash hash,
gpg_ctx_set_ostream (gpg, ostream);
if (gpg_ctx_op_start (gpg) == -1) {
- camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM,
- _("Failed to execute gpg."));
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
+ _("Failed to execute gpg: %s"), g_strerror (errno));
gpg_ctx_free (gpg);
return -1;
@@ -1236,7 +1244,9 @@ gpg_sign (CamelCipherContext *context, const char *userid, CamelCipherHash hash,
char *diagnostics;
diagnostics = gpg_ctx_get_diagnostics (gpg);
- camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, diagnostics);
+ camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM,
+ diagnostics && *diagnostics ? diagnostics :
+ _("Failed to execute gpg."));
g_free (diagnostics);
gpg_ctx_free (gpg);
@@ -1417,7 +1427,9 @@ gpg_encrypt (CamelCipherContext *context, gboolean sign, const char *userid,
char *diagnostics;
diagnostics = gpg_ctx_get_diagnostics (gpg);
- camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, diagnostics);
+ camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM,
+ diagnostics && *diagnostics ? diagnostics :
+ _("Failed to execute gpg."));
g_free (diagnostics);
gpg_ctx_free (gpg);
@@ -1473,7 +1485,9 @@ gpg_decrypt (CamelCipherContext *context, CamelStream *istream,
char *diagnostics;
diagnostics = gpg_ctx_get_diagnostics (gpg);
- camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, diagnostics);
+ camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM,
+ diagnostics && *diagnostics ? diagnostics :
+ _("Failed to execute gpg."));
g_free (diagnostics);
gpg_ctx_free (gpg);