From: Steinar H. Gunderson Date: Sat, 13 Apr 2013 19:50:13 +0000 (+0200) Subject: Fix a socket leak in HTTPInput. X-Git-Tag: 1.0.0~126 X-Git-Url: https://git.sesse.net/?p=cubemap;a=commitdiff_plain;h=51e357cb8decceaeab47332492962bc0175b0b13 Fix a socket leak in HTTPInput. --- diff --git a/httpinput.cpp b/httpinput.cpp index 9d39774..291b17f 100644 --- a/httpinput.cpp +++ b/httpinput.cpp @@ -114,6 +114,15 @@ int HTTPInput::lookup_and_connect(const string &host, const string &port) return sock; } + do { + err = close(sock); + } while (err == -1 && errno == EINTR); + + if (err == -1) { + perror("close"); + // Can still continue. + } + ai = ai->ai_next; }