Fix handling of error from proxy_write() in process_http_proxy()
authorDavid Woodhouse <David.Woodhouse@intel.com>
Sat, 12 May 2012 18:11:39 +0000 (11:11 -0700)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Sat, 12 May 2012 18:25:20 +0000 (11:25 -0700)
It returns the error; don't look in errno for it

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
http.c

diff --git a/http.c b/http.c
index 14d6b33..8374f3e 100644 (file)
--- a/http.c
+++ b/http.c
@@ -1059,11 +1059,11 @@ static int process_http_proxy(struct openconnect_info *vpninfo, int ssl_sock)
                     _("Requesting HTTP proxy connection to %s:%d\n"),
                     vpninfo->hostname, vpninfo->port);
 
-       if (proxy_write(vpninfo, ssl_sock, (unsigned char *)buf, strlen(buf))) {
-               result = -errno;
+       result = proxy_write(vpninfo, ssl_sock, (unsigned char *)buf, strlen(buf));
+       if (result) {
                vpn_progress(vpninfo, PRG_ERR,
                             _("Sending proxy request failed: %s\n"),
-                            strerror(errno));
+                            strerror(-result));
                return result;
        }