summaryrefslogtreecommitdiff
path: root/src/base
diff options
context:
space:
mode:
authorAli Saidi <saidi@eecs.umich.edu>2008-10-02 12:46:57 -0400
committerAli Saidi <saidi@eecs.umich.edu>2008-10-02 12:46:57 -0400
commit0a1613abe1d5ec9353001d68d6bb44bc64d97244 (patch)
treed94279ddad03615bb701cf3dcb76a56779cf6e22 /src/base
parent0bd9bbae4c9642933b4a0f7bc8de42eed0c20b2a (diff)
downloadgem5-0a1613abe1d5ec9353001d68d6bb44bc64d97244.tar.xz
Output: Verify output files are open after opening them.
Diffstat (limited to 'src/base')
-rw-r--r--src/base/stats/text.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/base/stats/text.cc b/src/base/stats/text.cc
index 6f40d92c8..f65b77777 100644
--- a/src/base/stats/text.cc
+++ b/src/base/stats/text.cc
@@ -107,7 +107,8 @@ Text::open(std::ostream &_stream)
mystream = false;
stream = &_stream;
- assert(valid());
+ if (!valid())
+ fatal("Unable to open output stream for writing\n");
}
void
@@ -118,13 +119,14 @@ Text::open(const std::string &file)
mystream = true;
stream = new ofstream(file.c_str(), ios::trunc);
- assert(valid());
+ if (!valid())
+ fatal("Unable to open statistics file for writing\n");
}
bool
Text::valid() const
{
- return stream != NULL;
+ return stream != NULL && stream->good();
}
void