ate sets failbit on some platforms

old-commit-hash: d90136c1d055369024b1223b0ead520f5aad5913
This commit is contained in:
Adeeb Shihadeh
2021-04-13 14:40:40 -07:00
parent 6f27d70605
commit 829afdfb87
+7 -6
View File
@@ -60,14 +60,15 @@ std::string read_file(const std::string& fn) {
if (ifs) {
return result;
}
} else {
// handle files created on read, e.g. procfs
std::stringstream buffer;
buffer << ifs.rdbuf();
return buffer.str();
}
}
return "";
ifs.close();
// fallback for files created on read, e.g. procfs
std::ifstream f(fn);
std::stringstream buffer;
buffer << f.rdbuf();
return buffer.str();
}
int write_file(const char* path, const void* data, size_t size, int flags, mode_t mode) {