mirror of
https://github.com/veracrypt/VeraCrypt
synced 2024-09-20 04:46:21 +02:00
Windows: check result of WriteFile and don't block if it is failing (Coverity)
This commit is contained in:
parent
05fd14006d
commit
a0809fe85c
@ -1216,10 +1216,16 @@ BOOL ExternalFormatFs (int driveNo, int clusterSize, int fsType)
|
||||
DWORD dwExitCode, dwWritten;
|
||||
LPCSTR newLine = "\n";
|
||||
|
||||
WriteFile(hChildStd_IN_Wr, (LPCVOID) newLine, 1, &dwWritten, NULL);
|
||||
|
||||
if (WriteFile(hChildStd_IN_Wr, (LPCVOID) newLine, 1, &dwWritten, NULL))
|
||||
{
|
||||
/* wait for the format process to finish */
|
||||
WaitForSingleObject (piProcInfo.hProcess, INFINITE);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* we failed to write "\n". Maybe process exited too quickly. We wait 1 second */
|
||||
WaitForSingleObject (piProcInfo.hProcess, 1000);
|
||||
}
|
||||
|
||||
/* check if it was successfull */
|
||||
if (GetExitCodeProcess (piProcInfo.hProcess, &dwExitCode))
|
||||
|
Loading…
Reference in New Issue
Block a user