diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2003-08-25 23:09:34 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2003-08-25 23:09:34 +0800 |
commit | 0357dde828171cb027545ca577a57a39f23b37f0 (patch) | |
tree | 836db7f230956f1b8a7c55659b03ad7dee0e7cfa | |
parent | cbf3647544de3dc02853c1652cfdbbeb29ce93dd (diff) | |
download | gsoc2013-evolution-0357dde828171cb027545ca577a57a39f23b37f0.tar.gz gsoc2013-evolution-0357dde828171cb027545ca577a57a39f23b37f0.tar.zst gsoc2013-evolution-0357dde828171cb027545ca577a57a39f23b37f0.zip |
Added some more error checking for reading/writing to the pipes. Fixes bug
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.
`
svn path=/trunk/; revision=22352
-rw-r--r-- | camel/ChangeLog | 5 | ||||
-rw-r--r-- | camel/camel-filter-driver.c | 25 |
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) { |