Skip to content

Commit

Permalink
Fixed ftruncate error check.
Browse files Browse the repository at this point in the history
  • Loading branch information
rakshasa committed Nov 28, 2024
1 parent 34bb0f4 commit 3adf66d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/data/socket_file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ SocketFile::set_size(uint64_t size) const {
if (!is_open())
throw internal_error("SocketFile::set_size() called on a closed file");

if (ftruncate(m_fd, size) != -1) {
LT_LOG_ERROR("ftruncate failed : %s", strerror(errno));
if (ftruncate(m_fd, size) == -1) {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion src/torrent/data/file.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ class LIBTORRENT_EXPORT lt_cacheline_aligned File {
int m_fd;
int m_protection;
int m_flags;

Path m_path;
std::string m_frozenPath;

Expand Down

0 comments on commit 3adf66d

Please sign in to comment.