Skip to content

Commit 04177d9

Browse files
committed
[ROSAUTOTEST]
- Flush file buffers after writing to the crash recovery journal svn path=/trunk/; revision=55933
1 parent 9624a85 commit 04177d9

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

rostests/rosautotest/CJournaledTestList.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ CJournaledTestList::SerializeIntoJournal(const string& String)
8383
{
8484
DWORD BytesWritten;
8585
WriteFile(m_hJournal, String.c_str(), String.size() + 1, &BytesWritten, NULL);
86+
FlushFileBuffers(m_hJournal);
8687
}
8788

8889
/**
@@ -98,6 +99,7 @@ CJournaledTestList::SerializeIntoJournal(const wstring& String)
9899
{
99100
DWORD BytesWritten;
100101
WriteFile(m_hJournal, String.c_str(), (String.size() + 1) * sizeof(WCHAR), &BytesWritten, NULL);
102+
FlushFileBuffers(m_hJournal);
101103
}
102104

103105
/**
@@ -169,6 +171,7 @@ CJournaledTestList::WriteInitialJournalFile()
169171
}
170172

171173
WriteFile(m_hJournal, &TerminatingNull, sizeof(TerminatingNull), &BytesWritten, NULL);
174+
FlushFileBuffers(m_hJournal);
172175

173176
CloseHandle(m_hJournal);
174177
m_hJournal = INVALID_HANDLE_VALUE;
@@ -248,6 +251,7 @@ CJournaledTestList::UpdateJournal()
248251
SetFilePointer(m_hJournal, sizeof(szJournalHeader), NULL, FILE_CURRENT);
249252

250253
WriteFile(m_hJournal, &m_ListIterator, sizeof(m_ListIterator), &BytesWritten, NULL);
254+
FlushFileBuffers(m_hJournal);
251255

252256
CloseHandle(m_hJournal);
253257
m_hJournal = NULL;

0 commit comments

Comments
 (0)