]> git.sesse.net Git - cubemap/commitdiff
Minor close-on-exec fix.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 2 Apr 2023 20:21:29 +0000 (22:21 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 2 Apr 2023 20:21:29 +0000 (22:21 +0200)
httpinput.cpp

index a972fa2ca9eb7d4b8783bc72fb5b2cda647bcd85..75cf99b9c8de73983e039bd2061dd7ef2da20c96 100644 (file)
@@ -80,7 +80,9 @@ HTTPInput::HTTPInput(const InputProto &serialized)
 {
        // Set back the close-on-exec flag for the socket.
        // (This can't leak into a child, since we haven't been started yet.)
-       fcntl(sock, F_SETFD, O_CLOEXEC);
+       if (sock != -1) {
+               fcntl(sock, F_SETFD, O_CLOEXEC);
+       }
 
        pending_data.resize(serialized.pending_data().size());
        memcpy(&pending_data[0], serialized.pending_data().data(), serialized.pending_data().size());