aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--camel/ChangeLog5
-rw-r--r--camel/camel-filter-driver.c25
2 files changed, 26 insertions, 4 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 701114b00a..717c3938b9 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,8 @@
+2003-08-25 Jeffrey Stedfast <fejj@ximian.com>
+
+ * camel-filter-driver.c (pipe_to_system): Added some more error
+ checking for reading/writing to the pipes. Fixes bug #47880.
+
2003-08-21 Jeffrey Stedfast <fejj@ximian.com>
* camel-data-wrapper.c (decode_to_stream): Don't poke
diff --git a/camel/camel-filter-driver.c b/camel/camel-filter-driver.c
index 3af4d3586a..204da435c7 100644
--- a/camel/camel-filter-driver.c
+++ b/camel/camel-filter-driver.c
@@ -644,7 +644,7 @@ pipe_to_system (struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFil
{
struct _CamelFilterDriverPrivate *p = _PRIVATE (driver);
int result, status, fds[4], i;
- CamelMimeMessage *message;
+ CamelMimeMessage *message = NULL;
CamelMimeParser *parser;
CamelStream *stream, *mem;
pid_t pid;
@@ -723,13 +723,28 @@ pipe_to_system (struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFil
close (fds[3]);
stream = camel_stream_fs_new_with_fd (fds[1]);
- camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (p->message), stream);
- camel_stream_flush (stream);
+ if (camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (p->message), stream) == -1) {
+ camel_object_unref (stream);
+ close (fds[2]);
+ goto wait;
+ }
+
+ if (camel_stream_flush (stream) == -1) {
+ camel_object_unref (stream);
+ close (fds[2]);
+ goto wait;
+ }
+
camel_object_unref (stream);
stream = camel_stream_fs_new_with_fd (fds[2]);
mem = camel_stream_mem_new ();
- camel_stream_write_to_stream (stream, mem);
+ if (camel_stream_write_to_stream (stream, mem) == -1) {
+ camel_object_unref (stream);
+ camel_object_unref (mem);
+ goto wait;
+ }
+
camel_object_unref (stream);
camel_stream_reset (mem);
@@ -754,6 +769,8 @@ pipe_to_system (struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFil
camel_object_unref (parser);
+ wait:
+
result = waitpid (pid, &status, 0);
if (result == -1 && errno == EINTR) {