From: Steinar H. Gunderson Date: Sun, 2 Apr 2023 20:21:29 +0000 (+0200) Subject: Minor close-on-exec fix. X-Git-Tag: 1.5.0~13 X-Git-Url: https://git.sesse.net/?p=cubemap;a=commitdiff_plain;h=edc6342c5106959a01f5e2d08a7cb95b3c24de9c Minor close-on-exec fix. --- diff --git a/httpinput.cpp b/httpinput.cpp index a972fa2..75cf99b 100644 --- a/httpinput.cpp +++ b/httpinput.cpp @@ -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());