campaignd: fixed file descriptor leak on sendfile() codepath

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

View file

@ -368,6 +368,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 };