Skip to content

Commit

Permalink
XrdTpc: Catch all negative return values not just SFS_ERROR.
Browse files Browse the repository at this point in the history
  • Loading branch information
bbockelm committed Jan 25, 2021
1 parent a4f7f93 commit 60d2ec0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/XrdTpc/XrdTpcStream.hh
Expand Up @@ -89,8 +89,10 @@ private:
size_desired -= (size_desired % (1024*1024));
if (!size_desired) {return 0;}
}
int retval = stream.Write(m_offset, &m_buffer[0], size_desired, force);
if ((retval == -1) || (static_cast<size_t>(retval) != size_desired)) {
ssize_t retval = stream.Write(m_offset, &m_buffer[0], size_desired, force);
// Currently the only valid negative value is SFS_ERROR (-1); checking for
// all negative values to future-proof the code.
if ((retval < 0) || (static_cast<size_t>(retval) != size_desired)) {
return -1;
}
// If partial data remains, copy it to the beginning of the buffer.
Expand Down

0 comments on commit 60d2ec0

Please sign in to comment.