Summary: Changing TFileTransport to not go to end of file by default
authorJames Wang <jwang@apache.org>
Sun, 22 Jul 2007 05:48:12 +0000 (05:48 +0000)
committerJames Wang <jwang@apache.org>
Sun, 22 Jul 2007 05:48:12 +0000 (05:48 +0000)
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

index 28a4261..51e9f08 100644 (file)
@@ -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) {