Bug 1409768 - Don't call fsync repeatedly when printing; r=bobowen

Usage of sync was a mistake when porting from the previous std::ostream code.

MozReview-Commit-ID: HwbFVlZMu6t

--HG--
extra : rebase_source : 86d251a9b73013356e4cc9323d35121839fafba9
This commit is contained in:
Alex Gaynor 2017-10-25 14:16:12 -04:00
parent 4e843e1cdb
commit bf64667f76

View File

@ -33,11 +33,8 @@ public:
}
void Flush() {
// We need to be API compatible with std::ostream, and so we silently handle
// flushes on a closed FD.
if (IsOpen()) {
PR_Sync(mFd);
}
// For std::ostream this flushes any internal buffers. PRFileDesc's IO isn't
// buffered, so nothing to do here.
}
void Seek(PRInt32 aOffset, PRSeekWhence aWhence) {
@ -45,7 +42,8 @@ public:
}
void write(const char* aData, size_t aSize) {
// See comment in Flush().
// We need to be API compatible with std::ostream, and so we silently handle
// writes on a closed FD.
if (IsOpen()) {
PR_Write(mFd, static_cast<const void*>(aData), aSize);
}