mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2025-11-11 19:08:26 -06:00
Windows: check result of WriteFile and don't block if it is failing (Coverity)
This commit is contained in:
@@ -1216,10 +1216,16 @@ BOOL ExternalFormatFs (int driveNo, int clusterSize, int fsType)
|
|||||||
DWORD dwExitCode, dwWritten;
|
DWORD dwExitCode, dwWritten;
|
||||||
LPCSTR newLine = "\n";
|
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 */
|
/* wait for the format process to finish */
|
||||||
WaitForSingleObject (piProcInfo.hProcess, INFINITE);
|
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 */
|
/* check if it was successfull */
|
||||||
if (GetExitCodeProcess (piProcInfo.hProcess, &dwExitCode))
|
if (GetExitCodeProcess (piProcInfo.hProcess, &dwExitCode))
|
||||||
|
|||||||
Reference in New Issue
Block a user