mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
Fix a weird bug in piping in some case if you pipe to no exists >pipe: then to a exists >pipe: it did make cmd crash for createfile only SetLastErrror when it fails. and the old one was in the loop. to solv it is to rest the GetLastError code before it is call.
svn path=/trunk/; revision=16562
This commit is contained in:
parent
521a302ab8
commit
3aae85b431
1 changed files with 9 additions and 3 deletions
|
@ -669,14 +669,20 @@ VOID ParseCommandLine (LPTSTR cmd)
|
||||||
{
|
{
|
||||||
SECURITY_ATTRIBUTES sa = {sizeof(SECURITY_ATTRIBUTES), NULL, TRUE};
|
SECURITY_ATTRIBUTES sa = {sizeof(SECURITY_ATTRIBUTES), NULL, TRUE};
|
||||||
|
|
||||||
/* Create unique temporary file name */
|
|
||||||
|
|
||||||
|
/* Create unique temporary file name */
|
||||||
GetTempFileName (szTempPath, _T("CMD"), 0, szFileName[1]);
|
GetTempFileName (szTempPath, _T("CMD"), 0, szFileName[1]);
|
||||||
|
|
||||||
|
/* we need make sure the LastError msg is zero before calling CreateFile */
|
||||||
|
SetLastError(0);
|
||||||
|
|
||||||
/* Set current stdout to temporary file */
|
/* Set current stdout to temporary file */
|
||||||
hFile[1] = CreateFile (szFileName[1], GENERIC_WRITE, 0, &sa,
|
hFile[1] = CreateFile (szFileName[1], GENERIC_WRITE, 0, &sa,
|
||||||
TRUNCATE_EXISTING, FILE_ATTRIBUTE_TEMPORARY, NULL);
|
TRUNCATE_EXISTING, FILE_ATTRIBUTE_TEMPORARY, NULL);
|
||||||
if (hFile[1] == INVALID_HANDLE_VALUE)
|
|
||||||
{
|
if (hFile[1] == INVALID_HANDLE_VALUE)
|
||||||
|
{
|
||||||
LoadString(CMD_ModuleHandle, STRING_CMD_ERROR2, szMsg, RC_STRING_MAX_SIZE);
|
LoadString(CMD_ModuleHandle, STRING_CMD_ERROR2, szMsg, RC_STRING_MAX_SIZE);
|
||||||
ConErrPrintf(szMsg);
|
ConErrPrintf(szMsg);
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue