wdvi

network DVI viewer
Log | Files | Refs

commit 3d3eb7e0c8e4582b06f9a38bfec9ccadf9a09681
parent dbb961b9660a3157addaf53b9713b1495b78e04c
Author: Kyle Milz <krwmilz@gmail.com>
Date:   Fri, 17 Sep 2021 18:54:29 +0000

popup a warning on connect() failure instead of err()

Update some comments while here.

Diffstat:
Mhttp.c | 18+++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/http.c b/http.c @@ -98,12 +98,11 @@ parse_url(const char dest_url[]) /* - * Takes a struct url and resolves the url hostname. Then tries connecting to - * the url hostname using "https" service port. This should be modified to - * use url->port. + * Takes a struct url and finds all addresses related to url->hostname. + * Then tries connecting to each of them, returning a connected socket on + * success. * - * On success return an open socket represented by a non negative integer or - * -1 on failure. + * Returns -1 on failure. */ static int xconnect(struct url *url) @@ -145,10 +144,15 @@ xconnect(struct url *url) /* connect() succeeded */ break; } - if (s == -1) - err(1, "%s", cause); + freeaddrinfo(res0); + if (s == -1) { + warning_popup_long("%s %s: %s\n", "OK", NULL, + cause, url->hostname, strerror(errno)); + return -1; + } + return s; }