[balsa/wip/gmime3: 15/197] Handle broken pipe and other errors before writing
- From: Peter Bloomfield <peterb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa/wip/gmime3: 15/197] Handle broken pipe and other errors before writing
- Date: Wed, 23 May 2018 21:13:37 +0000 (UTC)
commit 70231e4c976e3296d1ed3a51adb3e234e770ad41
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Wed Jun 28 16:00:16 2017 -0400
Handle broken pipe and other errors before writing
* src/balsa-index.c (pipe_in_watch): handle G_IO_HUP or G_IO_ERR
and return, before writing to the pipe.
ChangeLog | 7 +++++++
src/balsa-index.c | 21 ++++++++++++---------
2 files changed, 19 insertions(+), 9 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 412effb..2b71465 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2017-06-28 Peter Bloomfield <pbloomfield bellsouth net>
+
+ Handle broken pipe and other errors before writing to pipe
+
+ * src/balsa-index.c (pipe_in_watch): handle G_IO_HUP or G_IO_ERR
+ and return, before writing to the pipe.
+
2017-06-26 Peter Bloomfield <pbloomfield bellsouth net>
Remove dead assignment
diff --git a/src/balsa-index.c b/src/balsa-index.c
index fd15180..137436a 100644
--- a/src/balsa-index.c
+++ b/src/balsa-index.c
@@ -2317,6 +2317,17 @@ pipe_in_watch(GIOChannel *channel, GIOCondition condition, gpointer data)
gsize chars_written;
gboolean rc;
+ if ((condition & (G_IO_HUP | G_IO_ERR)) != 0) {
+ if ((condition & G_IO_HUP) != 0) {
+ fprintf(stderr, "pipe_in_watch: broken pipe. Aborts writing.\n");
+ }
+ if ((condition & G_IO_ERR) != 0) {
+ fprintf(stderr, "pipe_in_watch encountered error. Aborts writing.\n");
+ }
+ pipe_data_destroy(pipe);
+ return FALSE;
+ }
+
if( (condition & G_IO_OUT) == G_IO_OUT) {
status =
g_io_channel_write_chars(channel,
@@ -2346,15 +2357,7 @@ pipe_in_watch(GIOChannel *channel, GIOCondition condition, gpointer data)
break;
}
}
- if( (condition & G_IO_HUP) == G_IO_HUP) {
- pipe_data_destroy(pipe);
- rc = FALSE;
- }
- if( (condition & G_IO_ERR) == G_IO_ERR) {
- fprintf(stderr,
- "pipe_in_watch encountered error. Aborts writing.\n");
- return FALSE;
- }
+
rc = pipe->message_length > pipe->chars_written;
if(!rc) {
g_io_channel_unref(pipe->in_channel); pipe->in_channel = NULL;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]