Remove inappropriate exit() from library code
authorDavid Woodhouse <David.Woodhouse@intel.com>
Sun, 13 May 2012 03:30:27 +0000 (20:30 -0700)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Sun, 13 May 2012 03:30:33 +0000 (20:30 -0700)
It makes the auth-dialog very unhappy, if openconnect_obtain_cookie() calls
exit() from its thread when it gets cancelled. Distinctly suboptimal.

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

diff --git a/http.c b/http.c
index 3228361..ef13360 100644 (file)
--- a/http.c
+++ b/http.c
@@ -267,7 +267,7 @@ static int process_http_response(struct openconnect_info *vpninfo, int *result,
                        if (i < 0) {
                                vpn_progress(vpninfo, PRG_ERR,
                                             _("Error fetching chunk header\n"));
-                               exit(1);
+                               return i;
                        }
                        chunklen = strtol(buf, NULL, 16);
                        if (!chunklen) {
@@ -694,7 +694,7 @@ int openconnect_obtain_cookie(struct openconnect_info *vpninfo)
        buflen = process_http_response(vpninfo, &result, NULL, &form_buf);
        if (buflen < 0) {
                /* We'll already have complained about whatever offended us */
-               exit(1);
+               return buflen;
        }
 
        if (result != 200 && vpninfo->redirect_url) {