aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2002-02-05 03:58:02 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2002-02-05 03:58:02 +0800
commitec14bae134025fe2390c853ea224101bbdfc084f (patch)
tree2e596e8bcde49259e04101bbe79e3e9c9bb69a9e
parente1268e37a47ad717ee3cf3434a749ea32bf075c1 (diff)
downloadgsoc2013-evolution-ec14bae134025fe2390c853ea224101bbdfc084f.tar.gz
gsoc2013-evolution-ec14bae134025fe2390c853ea224101bbdfc084f.tar.zst
gsoc2013-evolution-ec14bae134025fe2390c853ea224101bbdfc084f.zip
Call set_errno appropriately.
2002-02-04 Jeffrey Stedfast <fejj@ximian.com> * camel-tcp-stream-ssl.c (stream_connect): Call set_errno appropriately. svn path=/trunk/; revision=15566
-rw-r--r--camel/ChangeLog5
-rw-r--r--camel/camel-tcp-stream-ssl.c15
2 files changed, 17 insertions, 3 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index dd91b0007d..287bc4cf02 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,8 @@
+2002-02-04 Jeffrey Stedfast <fejj@ximian.com>
+
+ * camel-tcp-stream-ssl.c (stream_connect): Call set_errno
+ appropriately.
+
2002-01-31 Not Zed <NotZed@Ximian.com>
* camel-mime-utils.c (header_decode_domain): Oops, this was
diff --git a/camel/camel-tcp-stream-ssl.c b/camel/camel-tcp-stream-ssl.c
index b63586ac9c..50c4684980 100644
--- a/camel/camel-tcp-stream-ssl.c
+++ b/camel/camel-tcp-stream-ssl.c
@@ -499,18 +499,27 @@ stream_connect (CamelTcpStream *stream, struct hostent *host, int port)
memset ((void *) &netaddr, 0, sizeof (PRNetAddr));
memcpy (&netaddr.inet.ip, host->h_addr, sizeof (netaddr.inet.ip));
- if (PR_InitializeNetAddr (PR_IpAddrNull, port, &netaddr) == PR_FAILURE)
+ if (PR_InitializeNetAddr (PR_IpAddrNull, port, &netaddr) == PR_FAILURE) {
+ set_errno (PR_GetError ());
return -1;
+ }
fd = PR_OpenTCPSocket (host->h_addrtype);
ssl_fd = SSL_ImportFD (NULL, fd);
-
+
SSL_OptionSet (ssl_fd, SSL_SECURITY, PR_TRUE);
SSL_SetURL (ssl_fd, ssl->priv->expected_host);
if (ssl_fd == NULL || PR_Connect (ssl_fd, &netaddr, timeout) == PR_FAILURE) {
- if (ssl_fd != NULL)
+ if (ssl_fd != NULL) {
+ int errnosave;
+
+ set_errno (PR_GetError ());
+ errnosave = errno;
PR_Close (ssl_fd);
+ errno = errnosave;
+ } else
+ errno = EINVAL;
return -1;
}