From d51643cbf99f57f1945eaedb30bde8efa714c7ac Mon Sep 17 00:00:00 2001 From: James Wang Date: Sun, 22 Jul 2007 05:48:12 +0000 Subject: [PATCH] Summary: Changing TFileTransport to not go to end of file by default Reviewed By: boz Test Plan: compiled and tested falcon's print utility Revert Plan: revertible git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665167 13f79535-47bb-0310-9956-ffa450edef68 --- lib/cpp/src/transport/TFileTransport.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/cpp/src/transport/TFileTransport.cpp b/lib/cpp/src/transport/TFileTransport.cpp index 28a42615..51e9f08b 100644 --- a/lib/cpp/src/transport/TFileTransport.cpp +++ b/lib/cpp/src/transport/TFileTransport.cpp @@ -742,6 +742,7 @@ void TFileTransport::openLogFile() { mode_t mode = readOnly_ ? S_IRUSR | S_IRGRP | S_IROTH : S_IRUSR | S_IWUSR| S_IRGRP | S_IROTH; int flags = readOnly_ ? O_RDONLY : O_RDWR | O_CREAT | O_APPEND; fd_ = ::open(filename_.c_str(), flags, mode); + offset_ = 0; // make sure open call was successful if(fd_ == -1) { @@ -750,9 +751,6 @@ void TFileTransport::openLogFile() { GlobalOutput(errorMsg); throw TTransportException(errorMsg); } - - // seek to the end of the file - offset_ = lseek(fd_, 0, SEEK_END); } void TFileTransport::getNextFlushTime(struct timespec* ts_next_flush) { -- 2.17.1