]> git.sesse.net Git - cubemap/commitdiff
Fix a possible corruption/crash when name lookups fail, due to incorrect error checki...
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 20 May 2013 13:47:41 +0000 (15:47 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 20 May 2013 13:47:41 +0000 (15:47 +0200)
httpinput.cpp

index 301aa3f9f81ebfe5c6b5d2f519841e19ceb1bf50..19167f0b6b7404df6592dc9e9e2805bd9424325d 100644 (file)
@@ -86,7 +86,7 @@ int HTTPInput::lookup_and_connect(const string &host, const string &port)
 {
        addrinfo *ai;
        int err = getaddrinfo(host.c_str(), port.c_str(), NULL, &ai);
 {
        addrinfo *ai;
        int err = getaddrinfo(host.c_str(), port.c_str(), NULL, &ai);
-       if (err == -1) {
+       if (err != 0) {
                log(WARNING, "[%s] Lookup of '%s' failed (%s).",
                        url.c_str(), host.c_str(), gai_strerror(err));
                return -1;
                log(WARNING, "[%s] Lookup of '%s' failed (%s).",
                        url.c_str(), host.c_str(), gai_strerror(err));
                return -1;