Fix a bug where a socket could be closed twice.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 26 Apr 2014 16:45:47 +0000 (18:45 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 26 Apr 2014 16:45:47 +0000 (18:45 +0200)
This would only happen if a HTTP input that wasn't fully setup yet
was no longer in use after an reload. This would normally manifest itself as
a “close(): Bad file descriptor”, but could also end up closing an arbitrary
descriptor, causing various sorts of havoc.

httpinput.cpp

index 68b9170..478356e 100644 (file)
@@ -94,6 +94,7 @@ void HTTPInput::close_socket()
 {
        if (sock != -1) {
                safe_close(sock);
+               sock = -1;
        }
 
        MutexLock lock(&stats_mutex);