diff options
author | Nilay Vaish <nilay@cs.wisc.edu> | 2013-04-17 16:09:37 -0500 |
---|---|---|
committer | Nilay Vaish <nilay@cs.wisc.edu> | 2013-04-17 16:09:37 -0500 |
commit | 3d858e5627b539713abb59c14363fb6af180e026 (patch) | |
tree | ad100a005dba182426183ad91e50e98ad90a5d76 /src | |
parent | b54e11862878cf88a427fa225407d1128abd21f2 (diff) | |
parent | 234c9a36a21fae7c0489e2f67b8e0385e61db732 (diff) | |
download | gem5-3d858e5627b539713abb59c14363fb6af180e026.tar.xz |
Merged c22628fa2564 and 2285b98847d7
Diffstat (limited to 'src')
-rw-r--r-- | src/dev/disk_image.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/dev/disk_image.cc b/src/dev/disk_image.cc index 84027d9b4..8194eb507 100644 --- a/src/dev/disk_image.cc +++ b/src/dev/disk_image.cc @@ -108,7 +108,8 @@ RawDiskImage::read(uint8_t *data, std::streampos offset) const if (!stream.is_open()) panic("file not open!\n"); - if (stream.seekg(offset * SectorSize, ios::beg) < 0) + stream.seekg(offset * SectorSize, ios::beg); + if (!stream.good()) panic("Could not seek to location in file"); streampos pos = stream.tellg(); @@ -132,7 +133,8 @@ RawDiskImage::write(const uint8_t *data, std::streampos offset) if (!stream.is_open()) panic("file not open!\n"); - if (stream.seekp(offset * SectorSize, ios::beg) < 0) + stream.seekp(offset * SectorSize, ios::beg); + if (!stream.good()) panic("Could not seek to location in file"); DPRINTF(DiskImageWrite, "write: offset=%d\n", (uint64_t)offset); |