summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@src.gnome.org>2001-10-30 04:24:28 +0000
committerJeffrey Stedfast <fejj@src.gnome.org>2001-10-30 04:24:28 +0000
commitc0613a8fe823b6f415700c9b531bb90e80dcafc3 (patch)
tree77ac8e1ad34d9c5ac235a51a5521860176295679
parentbe2d444b153528bcab9f02d8e6ddcac07af04621 (diff)
downloadevolution-data-server-c0613a8fe823b6f415700c9b531bb90e80dcafc3.tar.gz
fixed a compile problem and saved errno before calling fcntl() in stream_read
-rw-r--r--camel/camel-tcp-stream-openssl.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/camel/camel-tcp-stream-openssl.c b/camel/camel-tcp-stream-openssl.c
index 17d5ab096..e7dab0aaf 100644
--- a/camel/camel-tcp-stream-openssl.c
+++ b/camel/camel-tcp-stream-openssl.c
@@ -176,7 +176,8 @@ errlib_error_to_errno (int ret)
if (error == 0) {
if (ret == 0)
errno = EINVAL; /* unexpected EOF */
- errno = 0;
+ else
+ errno = 0;
} else if (!errno) {
/* ok, we get the shaft now. */
errno = EINTR;
@@ -231,7 +232,7 @@ stream_read (CamelStream *stream, char *buffer, size_t n)
ssl_error_to_errno (ssl, nread);
} while (nread < 0 && (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK));
} else {
- int flags, fdmax;
+ int error, flags, fdmax;
fd_set rdset;
flags = fcntl (tcp_stream_openssl->priv->sockfd, F_GETFL);
@@ -257,7 +258,9 @@ stream_read (CamelStream *stream, char *buffer, size_t n)
} while (nread < 0 && errno == EINTR);
} while (nread < 0 && (errno == EAGAIN || errno == EWOULDBLOCK));
+ error = errno;
fcntl (tcp_stream_openssl->priv->sockfd, F_SETFL, flags);
+ errno = error;
}
return nread;
@@ -290,7 +293,7 @@ stream_write (CamelStream *stream, const char *buffer, size_t n)
} while (w != -1 && written < n);
} else {
fd_set rdset, wrset;
- int flags, fdmax;
+ int error, flags, fdmax;
flags = fcntl (tcp_stream_openssl->priv->sockfd, F_GETFL);
fcntl (tcp_stream_openssl->priv->sockfd, F_SETFL, flags | O_NONBLOCK);