* winsup.h (flush_file_buffers): Declare new function.

(FLushFileBuffers): New define.
	* miscfuncs.cc (flush_file_buffers): Define new function.
This commit is contained in:
Corinna Vinschen
2005-12-20 20:19:55 +00:00
parent 7c578a4fa0
commit 56c07aa2ce
3 changed files with 19 additions and 0 deletions

View File

@ -361,3 +361,14 @@ create_pipe (PHANDLE hr,PHANDLE hw, LPSECURITY_ATTRIBUTES sa, DWORD n)
break;
return false;
}
#undef FlushFileBuffers
bool
flush_file_buffers (HANDLE h)
{
DWORD ftype = GetFileType (h);
/* Per MSDN, FlushFileBuffers on named pipes might block. This is the last
we want it to do, especially when printing debug output as when calling
system_printf. */
return (ftype != FILE_TYPE_PIPE) ? FlushFileBuffers (h) : true;
}