Cygwin: pty: Fix 'Bad address' error when running 'cmd.exe /c dir'

- If the command executed is 'cmd.exe /c [...]', runpath in spawn.cc
  will be NULL. In this case, is_console_app(runpath) check causes
  access violation. This case also the command executed is obviously
  console app., therefore, treat it as console app to fix this issue.

  Addresses: https://github.com/msys2/msys2-runtime/issues/108
This commit is contained in:
Takashi Yano 2022-10-22 14:05:40 +09:00
parent 1ca46b22d6
commit 08281cf4cc
1 changed files with 2 additions and 0 deletions

View File

@ -198,6 +198,8 @@ handle (int fd, bool writing)
static bool
is_console_app (WCHAR *filename)
{
if (filename == NULL)
return true; /* The command executed is command.com or cmd.exe. */
HANDLE h;
const int id_offset = 92;
h = CreateFileW (filename, GENERIC_READ, FILE_SHARE_READ,