| Index: test/file-stream.h
|
| diff --git a/test/file-stream.h b/test/file-stream.h
|
| old mode 100644
|
| new mode 100755
|
| index d25c9d967c46f4a159d43c54b82dd536b38290eb..44dd4a1e0fb89d40f0d40bdd4090f7a6b7974884
|
| --- a/test/file-stream.h
|
| +++ b/test/file-stream.h
|
| @@ -17,10 +17,12 @@ class FILEStream : public OTSStream {
|
| }
|
|
|
| ~FILEStream() {
|
| + if (file_)
|
| + fclose(file_);
|
| }
|
|
|
| bool WriteRaw(const void *data, size_t length) {
|
| - if (::fwrite(data, length, 1, file_) == 1) {
|
| + if (!file_ || ::fwrite(data, length, 1, file_) == 1) {
|
| position_ += length;
|
| return true;
|
| }
|
| @@ -29,12 +31,12 @@ class FILEStream : public OTSStream {
|
|
|
| bool Seek(off_t position) {
|
| #if defined(_WIN32)
|
| - if (!::_fseeki64(file_, position, SEEK_SET)) {
|
| + if (!file_ || !::_fseeki64(file_, position, SEEK_SET)) {
|
| position_ = position;
|
| return true;
|
| }
|
| #else
|
| - if (!::fseeko(file_, position, SEEK_SET)) {
|
| + if (!file_ || !::fseeko(file_, position, SEEK_SET)) {
|
| position_ = position;
|
| return true;
|
| }
|
|
|