campaignd: fixed file descriptor leak on sendfile() codepath

This commit is contained in:
loonycyborg 2022-09-13 19:46:03 +03:00
parent ad02e381f2
commit ec789c5051
No known key found for this signature in database
GPG Key ID: 6E8233FAB8F26D61

View File

@ -369,6 +369,7 @@ void server_base::coro_send_file(socket_ptr socket, const std::string& filename,
{
std::size_t filesize { std::size_t(filesystem::file_size(filename)) };
int in_file { open(filename.c_str(), O_RDONLY) };
ON_SCOPE_EXIT(in_file) { close(in_file); };
off_t offset { 0 };
//std::size_t total_bytes_transferred { 0 };