MCPcopy Create free account
hub / github.com/apache/thrift / resetOutputFile

Method resetOutputFile

lib/cpp/src/thrift/transport/TFileTransport.cpp:96–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94}
95
96void TFileTransport::resetOutputFile(int fd, string filename, off_t offset) {
97 filename_ = filename;
98 offset_ = offset;
99
100 // check if current file is still open
101 if (fd_ > 0) {
102 // flush any events in the queue
103 flush();
104 TOutput::instance().printf("error, current file (%s) not closed", filename_.c_str());
105 if (-1 == ::THRIFT_CLOSE(fd_)) {
106 int errno_copy = THRIFT_ERRNO;
107 TOutput::instance().perror("TFileTransport: resetOutputFile() ::close() ", errno_copy);
108 throw TTransportException(TTransportException::UNKNOWN,
109 "TFileTransport: error in file close",
110 errno_copy);
111 } else {
112 // successfully closed fd
113 fd_ = 0;
114 }
115 }
116
117 if (fd) {
118 fd_ = fd;
119 } else {
120 // open file if the input fd is 0
121 openLogFile();
122 }
123}
124
125TFileTransport::~TFileTransport() {
126 // flush the buffer if a writer thread is active

Callers

nothing calls this directly

Calls 3

printfMethod · 0.80
TTransportExceptionClass · 0.70
perrorMethod · 0.45

Tested by

no test coverage detected