summaryrefslogtreecommitdiff
path: root/src/base
diff options
context:
space:
mode:
authorAli Saidi <saidi@eecs.umich.edu>2008-05-15 19:10:26 -0400
committerAli Saidi <saidi@eecs.umich.edu>2008-05-15 19:10:26 -0400
commite71a5270a2fe040e0542bc2c74a11a303688f6ae (patch)
treea4714028a2aabebeda1147d0c6a5a17cd75203fb /src/base
parent4a4317ae18504226d298d42929b9882837ab1b44 (diff)
downloadgem5-e71a5270a2fe040e0542bc2c74a11a303688f6ae.tar.xz
Make sure that output files are always checked success before they're used.
Make OutputDirectory::resolve() private and change the functions using resolve() to instead use create(). --HG-- extra : convert_revision : 36d4be629764d0c4c708cec8aa712cd15f966453
Diffstat (limited to 'src/base')
-rw-r--r--src/base/output.cc4
-rw-r--r--src/base/output.hh3
2 files changed, 4 insertions, 3 deletions
diff --git a/src/base/output.cc b/src/base/output.cc
index 9d02a4a71..5a1768a76 100644
--- a/src/base/output.cc
+++ b/src/base/output.cc
@@ -98,7 +98,7 @@ OutputDirectory::create(const string &name, bool binary)
ofstream *file = new ofstream(resolve(name).c_str(),
ios::trunc | binary ? ios::binary : (ios::openmode)0);
if (!file->is_open())
- panic("Cannot open file %s", name);
+ fatal("Cannot open file %s", name);
return file;
}
@@ -119,7 +119,7 @@ OutputDirectory::find(const string &name)
ofstream *file = new ofstream(filename.c_str(), ios::trunc);
if (!file->is_open())
- panic("Cannot open file %s", filename);
+ fatal("Cannot open file %s", filename);
files[filename] = file;
return file;
diff --git a/src/base/output.hh b/src/base/output.hh
index 5de0c4005..b1d1d7e7d 100644
--- a/src/base/output.hh
+++ b/src/base/output.hh
@@ -43,6 +43,8 @@ class OutputDirectory
map_t files;
std::string dir;
+ std::string resolve(const std::string &name);
+
public:
OutputDirectory();
~OutputDirectory();
@@ -50,7 +52,6 @@ class OutputDirectory
void setDirectory(const std::string &dir);
const std::string &directory();
- std::string resolve(const std::string &name);
std::ostream *create(const std::string &name, bool binary = false);
std::ostream *find(const std::string &name);