1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00

Fix named_pipe_agent_exists(), which just didn't work.

GetFileType() takes a HANDLE, not a pathname. So passing it the
pathname of the agent named pipe would never have worked at all.

I hadn't noticed, because the only call to that function logical-ORs
its return value with that of wm_copydata_agent_exists(), and the
latter _does_ work.

So if you're running true Pageant, which presents both IPC interfaces,
then there's no problem. But if a Pageant-emulating system wanted to
present only the named-pipe version, then we wouldn't have detected
it. Now we should do.
This commit is contained in:
Simon Tatham 2021-04-25 06:07:31 +01:00
parent f69cf86a61
commit 17371e0df0

View File

@ -153,9 +153,13 @@ Socket *agent_connect(Plug *plug)
static bool named_pipe_agent_exists(void)
{
char *pipename = agent_named_pipe_name();
DWORD type = GetFileType(pipename);
WIN32_FIND_DATA data;
HANDLE ffh = FindFirstFile(pipename, &data);
sfree(pipename);
return type == FILE_TYPE_PIPE;
if (ffh == INVALID_HANDLE_VALUE)
return false;
FindClose(ffh);
return true;
}
bool agent_exists(void)