Skip to content

Commit 5497cb6

Browse files
committed
Processing (Windows): generate unique pipe name
Fix fastfetch-cli#1346
1 parent bd4bc87 commit 5497cb6

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/common/processing_windows.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,11 @@ const char* ffProcessAppendOutput(FFstrbuf* buffer, char* const argv[], bool use
4949
{
5050
int timeout = instance.config.general.processingTimeout;
5151

52+
wchar_t pipeName[32];
53+
swprintf(pipeName, sizeof(pipeName) / sizeof(*pipeName), L"\\\\.\\pipe\\FASTFETCH-%u", GetCurrentProcessId());
54+
5255
FF_AUTO_CLOSE_FD HANDLE hChildPipeRead = CreateNamedPipeW(
53-
L"\\\\.\\pipe\\LOCAL\\",
56+
pipeName,
5457
PIPE_ACCESS_INBOUND | FILE_FLAG_FIRST_PIPE_INSTANCE | (timeout < 0 ? 0 : FILE_FLAG_OVERLAPPED),
5558
0,
5659
1,
@@ -60,10 +63,10 @@ const char* ffProcessAppendOutput(FFstrbuf* buffer, char* const argv[], bool use
6063
NULL
6164
);
6265
if (hChildPipeRead == INVALID_HANDLE_VALUE)
63-
return "CreateNamedPipeW(L\"\\\\.\\pipe\\LOCAL\\\") failed";
66+
return "CreateNamedPipeW(L\"\\\\.\\pipe\\FASTFETCH-$(PID)\") failed";
6467

6568
HANDLE hChildPipeWrite = CreateFileW(
66-
L"\\\\.\\pipe\\LOCAL\\",
69+
pipeName,
6770
GENERIC_WRITE,
6871
0,
6972
&(SECURITY_ATTRIBUTES){
@@ -76,7 +79,7 @@ const char* ffProcessAppendOutput(FFstrbuf* buffer, char* const argv[], bool use
7679
NULL
7780
);
7881
if (hChildPipeWrite == INVALID_HANDLE_VALUE)
79-
return "CreateFileW(L\"\\\\.\\pipe\\LOCAL\\\") failed";
82+
return "CreateFileW(L\"\\\\.\\pipe\\FASTFETCH-$(PID)\") failed";
8083

8184
PROCESS_INFORMATION piProcInfo = {0};
8285

0 commit comments

Comments
 (0)