Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
1.2.0
-
None
-
CentOS7
Description
cgroups::internal::write does not flush stream before checking for errors after writing:
ofstream file(path.c_str()); ... file << value; if (file.fail()) { // TODO(jieyu): Does ofstream actually set errno? return ErrnoError(); }
Since ofstream does internal buffering, file.fail() can return false, as value hasn't been written to file yet.
Replacing file << value; with file << value << std::flush; makes file.fail() behave as expected.