aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2002-06-28 07:16:37 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2002-06-28 07:16:37 +0800
commit46bba132c7e353a3bba252ddf4f484b0c237ac46 (patch)
tree3e33176a1b3432e904dd69c8fa705710cb90b8a3 /camel
parent11935da7a63b3c1055729854c8c551c9e9e3921a (diff)
downloadgsoc2013-evolution-46bba132c7e353a3bba252ddf4f484b0c237ac46.tar
gsoc2013-evolution-46bba132c7e353a3bba252ddf4f484b0c237ac46.tar.gz
gsoc2013-evolution-46bba132c7e353a3bba252ddf4f484b0c237ac46.tar.bz2
gsoc2013-evolution-46bba132c7e353a3bba252ddf4f484b0c237ac46.tar.lz
gsoc2013-evolution-46bba132c7e353a3bba252ddf4f484b0c237ac46.tar.xz
gsoc2013-evolution-46bba132c7e353a3bba252ddf4f484b0c237ac46.tar.zst
gsoc2013-evolution-46bba132c7e353a3bba252ddf4f484b0c237ac46.zip
Loop on our reads while errno is EINTR or EAGAIN. Also make sure to
2002-06-27 Jeffrey Stedfast <fejj@ximian.com> * camel-gpg-context.c (gpg_ctx_op_step): Loop on our reads while errno is EINTR or EAGAIN. Also make sure to completely read stdout and stderr by keeping better state. (gpg_ctx_parse_status): In the case of a NODATA response from gpg, try to use the diagnostics that gpg may have written to its stderr. svn path=/trunk/; revision=17319
Diffstat (limited to 'camel')
-rw-r--r--camel/ChangeLog3
-rw-r--r--camel/camel-gpg-context.c13
2 files changed, 13 insertions, 3 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 4aed3c347a..468596b931 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -3,6 +3,9 @@
* camel-gpg-context.c (gpg_ctx_op_step): Loop on our reads while
errno is EINTR or EAGAIN. Also make sure to completely read stdout
and stderr by keeping better state.
+ (gpg_ctx_parse_status): In the case of a NODATA response from gpg,
+ try to use the diagnostics that gpg may have written to its
+ stderr.
2002-06-26 Jeffrey Stedfast <fejj@ximian.com>
diff --git a/camel/camel-gpg-context.c b/camel/camel-gpg-context.c
index 2483a10c59..7d5f167d64 100644
--- a/camel/camel-gpg-context.c
+++ b/camel/camel-gpg-context.c
@@ -778,8 +778,12 @@ gpg_ctx_parse_status (struct _GpgCtx *gpg, CamelException *ex)
return -1;
} else if (!strncmp (status, "NODATA", 6)) {
/* this is an error */
- camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM,
- _("No data provided"));
+ if (gpg->diagnostics->len)
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, "%.*s",
+ gpg->diagnostics->len, gpg->diagnostics->data);
+ else
+ camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM,
+ _("No data provided"));
return -1;
} else {
/* check to see if we are complete */
@@ -1023,7 +1027,7 @@ gpg_ctx_op_step (struct _GpgCtx *gpg, CamelException *ex)
char buffer[4096];
ssize_t nread;
- d(printf ("writing to gpg's stdin..."));
+ d(printf ("writing to gpg's stdin...\n"));
/* write our stream to gpg's stdin */
nread = camel_stream_read (gpg->istream, buffer, sizeof (buffer));
@@ -1039,11 +1043,14 @@ gpg_ctx_op_step (struct _GpgCtx *gpg, CamelException *ex)
nwritten += w;
} while (nwritten < nread && w != -1);
+ d(printf ("wrote %d (out of %d) bytes to gpg's stdin\n", nwritten, nread));
+
if (w == -1)
goto exception;
}
if (camel_stream_eos (gpg->istream)) {
+ d(printf ("closing gpg's stdin\n"));
close (gpg->stdin);
gpg->stdin = -1;
}