diff options
author | Not Zed <NotZed@Ximian.com> | 2001-09-08 08:45:24 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2001-09-08 08:45:24 +0800 |
commit | f1e3395ff231298f05120917817d5ed1732345b6 (patch) | |
tree | 1f26989cae46e4d2238e35df2047a45323d0bbd6 /camel/camel-tcp-stream-raw.c | |
parent | 1751d7033533f18c89dd0d65853eb7ddbf0e2a88 (diff) | |
download | gsoc2013-evolution-f1e3395ff231298f05120917817d5ed1732345b6.tar.gz gsoc2013-evolution-f1e3395ff231298f05120917817d5ed1732345b6.tar.zst gsoc2013-evolution-f1e3395ff231298f05120917817d5ed1732345b6.zip |
Likewise.
2001-09-08 Not Zed <NotZed@Ximian.com>
* providers/local/camel-spool-summary.c (spool_summary_sync_full): Likewise.
* providers/local/camel-mbox-summary.c (mbox_summary_sync_full): Fix the wording.
* camel-tcp-stream-raw.c (stream_read): Save errno around fcntl
call in cancellable read case. Also, loop while we get EINTR.
This might fix some weird reconnect behaviour with pop.
(stream_write): "
svn path=/trunk/; revision=12700
Diffstat (limited to 'camel/camel-tcp-stream-raw.c')
-rw-r--r-- | camel/camel-tcp-stream-raw.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/camel/camel-tcp-stream-raw.c b/camel/camel-tcp-stream-raw.c index c269165411..0aa9c2e1e5 100644 --- a/camel/camel-tcp-stream-raw.c +++ b/camel/camel-tcp-stream-raw.c @@ -130,7 +130,8 @@ stream_read (CamelStream *stream, char *buffer, size_t n) CamelTcpStreamRaw *tcp_stream_raw = CAMEL_TCP_STREAM_RAW (stream); ssize_t nread; int cancel_fd; - + int saveerrno; + if (camel_operation_cancel_check (NULL)) { errno = EINTR; return -1; @@ -160,8 +161,12 @@ stream_read (CamelStream *stream, char *buffer, size_t n) return -1; } - nread = read (tcp_stream_raw->sockfd, buffer, n); + do { + nread = read (tcp_stream_raw->sockfd, buffer, n); + } while (nread == -1 && errno == EINTR); + saveerrno = errno; fcntl (tcp_stream_raw->sockfd, F_SETFL, flags); + errno = saveerrno; } return nread; @@ -173,7 +178,8 @@ stream_write (CamelStream *stream, const char *buffer, size_t n) CamelTcpStreamRaw *tcp_stream_raw = CAMEL_TCP_STREAM_RAW (stream); ssize_t w, written = 0; int cancel_fd; - + int saveerrno; + if (camel_operation_cancel_check (NULL)) { errno = EINTR; return -1; @@ -205,12 +211,17 @@ stream_write (CamelStream *stream, const char *buffer, size_t n) return -1; } - w = write (tcp_stream_raw->sockfd, buffer + written, n - written); + do { + w = write (tcp_stream_raw->sockfd, buffer + written, n - written); + } while (w == -1 && errno == EINTR); + if (w > 0) written += w; } while (w != -1 && written < n); + saveerrno = errno; fcntl (tcp_stream_raw->sockfd, F_SETFL, flags); + errno = saveerrno; } return written; |