winpr/file: don't close stdin/stdout/stderr

If the handle is closed stdin/stdout/stderr should be left open.
This commit is contained in:
Bernhard Miklautz 2015-09-09 17:07:40 +02:00
parent 8091530779
commit 0f5e7c60a7
2 changed files with 8 additions and 2 deletions

View File

@ -74,8 +74,13 @@ static BOOL FileCloseHandle(HANDLE handle) {
if (file->fd != -1)
{
close(file->fd);
file->fd = -1;
/* Don't close stdin/stdout/stderr */
if (file->fd > 2)
{
close(file->fd);
file->fd = -1;
}
}
free(handle);

View File

@ -41,6 +41,7 @@ int TestFileGetStdHandle(int argc, char* argv[])
fprintf(stderr, "write failed\n");
return -1;
}
CloseHandle(stdout);
return 0;
}