1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-10-15 16:02:25 +00:00

ProtocolServer: Use an empty Optional<IPC::File> to pass along "no fd"

Passing `-1` wouldn't work, as these are passed to `sendfd()'.
Fixes #4706.
This commit is contained in:
AnotherTest 2021-01-01 12:21:11 +03:30 committed by Andreas Kling
parent f2973875e3
commit 887a62582d
3 changed files with 6 additions and 6 deletions

View file

@ -62,13 +62,13 @@ OwnPtr<Messages::ProtocolServer::StartDownloadResponse> ClientConnection::handle
{
URL url(message.url());
if (!url.is_valid())
return make<Messages::ProtocolServer::StartDownloadResponse>(-1, -1);
return make<Messages::ProtocolServer::StartDownloadResponse>(-1, Optional<IPC::File> {});
auto* protocol = Protocol::find_by_name(url.protocol());
if (!protocol)
return make<Messages::ProtocolServer::StartDownloadResponse>(-1, -1);
return make<Messages::ProtocolServer::StartDownloadResponse>(-1, Optional<IPC::File> {});
auto download = protocol->start_download(*this, message.method(), url, message.request_headers().entries(), message.request_body());
if (!download)
return make<Messages::ProtocolServer::StartDownloadResponse>(-1, -1);
return make<Messages::ProtocolServer::StartDownloadResponse>(-1, Optional<IPC::File> {});
auto id = download->id();
auto fd = download->download_fd();
m_downloads.set(id, move(download));