aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-stream-buffer.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-10-30 11:09:01 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-10-30 11:09:01 +0800
commit2a5e8cb1796782940d84a3928d69d6bad41a33ca (patch)
tree37d597e3d75431998097f647ae27c9ef47418674 /camel/camel-stream-buffer.c
parentb11817f3a8babd22d6b5cb8a9a18132f274ace9f (diff)
downloadgsoc2013-evolution-2a5e8cb1796782940d84a3928d69d6bad41a33ca.tar.gz
gsoc2013-evolution-2a5e8cb1796782940d84a3928d69d6bad41a33ca.tar.zst
gsoc2013-evolution-2a5e8cb1796782940d84a3928d69d6bad41a33ca.zip
Removed. (stream_write): Keep looping (non-blocking case) if errno is
2001-10-29 Jeffrey Stedfast <fejj@ximian.com> * camel-tcp-stream-openssl.c (my_SSL_write): Removed. (stream_write): Keep looping (non-blocking case) if errno is EAGAIN, EINTR or EWOULDBLOCK. For NONBLOCKing I/O, sync up with CamelTcpStreamRaw. As with CamelTcpStreamRaw/SSL - make sure to write out everything before returning. (my_SSL_read): Removed. (stream_read): Just call ssl_error_to_errno() and check the errno values that we care about so we can keep the general look of all this stream code the same. Also when checking the return value of SSL_read, check for <0 instead of ==-1 since the man page for SSL_read doesn't say it will return -1 on fail, it just says <0. (stream_flush): Don't fsync() since syncing on a socket is a Bad Thing (tm). * camel-tcp-stream-ssl.c (stream_write): Make sure we write out everything just like in camel-tcp-stream-raw.c. * camel-stream-buffer.c (camel_stream_buffer_gets): If camel_stream_read() returns -1, don't necessarily return -1 to our caller since it's possible that we did actually "read" some data (ie, we copied some pre-buffered data into the out buffer). * camel-stream-buffer.h: Removed CAMEL_STREAM_BUFFER_NEWLINE since it never got used anywhere and it isn't supported anyway. svn path=/trunk/; revision=14409
Diffstat (limited to 'camel/camel-stream-buffer.c')
-rw-r--r--camel/camel-stream-buffer.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/camel/camel-stream-buffer.c b/camel/camel-stream-buffer.c
index 3d7ac5e845..fe3458a93f 100644
--- a/camel/camel-stream-buffer.c
+++ b/camel/camel-stream-buffer.c
@@ -401,9 +401,13 @@ int camel_stream_buffer_gets(CamelStreamBuffer *sbf, char *buf, unsigned int max
if (outptr == outend)
break;
- bytes_read = camel_stream_read(sbf->stream, sbf->buf, sbf->size);
- if (bytes_read == -1)
- return -1;
+ bytes_read = camel_stream_read (sbf->stream, sbf->buf, sbf->size);
+ if (bytes_read == -1) {
+ if (buf == outptr)
+ return -1;
+ else
+ bytes_read = 0;
+ }
inptr = sbf->ptr = sbf->buf;
inend = sbf->end = sbf->buf + bytes_read;
} while (bytes_read>0);