Given that we're happy to let MinGW not set CLOEXEC, would it be better to do the same on Unix when unable to set CLOEXEC ?
In any case, if you're going to return early, don't you need to close(log_fd); log_fd = -1; ?