Repository: thrift Updated Branches: refs/heads/master 7110ab295 -> 8ccd63494
THRIFT-3077 TFileTransport fix ignored ftruncate result Project: http://git-wip-us.apache.org/repos/asf/thrift/repo Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/8ccd6349 Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/8ccd6349 Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/8ccd6349 Branch: refs/heads/master Commit: 8ccd634946077f8915385d5dbd320622b6e70ef3 Parents: 7110ab2 Author: Jim King <[email protected]> Authored: Sat Apr 4 15:58:57 2015 -0400 Committer: Roger Meier <[email protected]> Committed: Tue Apr 7 23:23:31 2015 +0200 ---------------------------------------------------------------------- lib/cpp/src/thrift/transport/TFileTransport.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/thrift/blob/8ccd6349/lib/cpp/src/thrift/transport/TFileTransport.cpp ---------------------------------------------------------------------- diff --git a/lib/cpp/src/thrift/transport/TFileTransport.cpp b/lib/cpp/src/thrift/transport/TFileTransport.cpp index fe6ef9b..8f6fe8e 100644 --- a/lib/cpp/src/thrift/transport/TFileTransport.cpp +++ b/lib/cpp/src/thrift/transport/TFileTransport.cpp @@ -310,8 +310,13 @@ void TFileTransport::writerThread() { seekToEnd(); // throw away any partial events offset_ += readState_.lastDispatchPtr_; - THRIFT_FTRUNCATE(fd_, offset_); - readState_.resetAllValues(); + if (0 == THRIFT_FTRUNCATE(fd_, offset_)) { + readState_.resetAllValues(); + } else { + int errno_copy = THRIFT_ERRNO; + GlobalOutput.perror("TFileTransport: writerThread() truncate ", errno_copy); + hasIOError = true; + } } catch (...) { int errno_copy = THRIFT_ERRNO; GlobalOutput.perror("TFileTransport: writerThread() initialization ", errno_copy);
