Index: wget-1.18/src/http.c =================================================================== --- wget-1.18.orig/src/http.c +++ wget-1.18/src/http.c @@ -1516,6 +1516,7 @@ persistent_available_p (const char *host active, registered connection". */ #define CLOSE_FINISH(fd) do { \ + int errno_sav = errno; \ if (!keep_alive) \ { \ if (pconn_active && (fd) == pconn.socket) \ @@ -1524,14 +1525,17 @@ persistent_available_p (const char *host fd_close (fd); \ fd = -1; \ } \ + errno = errno_sav; \ } while (0) #define CLOSE_INVALIDATE(fd) do { \ + int errno_sav = errno; \ if (pconn_active && (fd) == pconn.socket) \ invalidate_persistent (); \ else \ fd_close (fd); \ fd = -1; \ + errno = errno_sav; \ } while (0) struct http_stat