[evolution-data-server] Bug 676155 - [POP3] Use 'Broken pipe' error for end-of-stream case



commit 922783b72dbd10bae81af1e2f06d70047270e40b
Author: Milan Crha <mcrha redhat com>
Date:   Wed Jun 10 14:48:46 2015 +0200

    Bug 676155 - [POP3] Use 'Broken pipe' error for end-of-stream case

 camel/providers/pop3/camel-pop3-stream.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/camel/providers/pop3/camel-pop3-stream.c b/camel/providers/pop3/camel-pop3-stream.c
index dba6feb..6de7b88 100644
--- a/camel/providers/pop3/camel-pop3-stream.c
+++ b/camel/providers/pop3/camel-pop3-stream.c
@@ -25,6 +25,7 @@
 
 #include <stdio.h>
 #include <string.h>
+#include <errno.h>
 
 #include "camel-pop3-stream.h"
 
@@ -78,7 +79,18 @@ stream_fill (CamelPOP3Stream *is,
                        is->source, (gchar *) is->end,
                        CAMEL_POP3_STREAM_SIZE - (is->end - is->buf),
                        cancellable, &local_error);
-               if (local_error) {
+
+               /* It's the End Of Stream marker */
+               if (left == 0 && !local_error) {
+                       g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_BROKEN_PIPE,
+                               g_strerror (
+                                       #ifdef EPIPE
+                                       EPIPE
+                                       #else
+                                       32 /* Also EPIPE; it should be always available, but just in case it 
isn't */
+                                       #endif
+                               ));
+               } else if (local_error) {
                        g_propagate_error (error, local_error);
                        left = 0;
                }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]