[client,x11] add signal cleanup handler for pipe

This commit is contained in:
Armin Novak
2023-07-03 10:08:54 +02:00
committed by Martin Fleisz
parent 3dbd9c7eeb
commit fe987091f4

View File

@@ -1272,6 +1272,14 @@ static BOOL xf_process_pipe(rdpContext* context, const char* pipe)
return TRUE;
}
static void cleanup_pipe(int signum, const char* signame, void* context)
{
const char* pipe = context;
if (!pipe)
return;
unlink(pipe);
}
static DWORD WINAPI xf_handle_pipe(void* arg)
{
xfContext* xfc = arg;
@@ -1292,9 +1300,11 @@ static DWORD WINAPI xf_handle_pipe(void* arg)
WLog_ERR(TAG, "Failed to create named pipe '%s': %s [%d]", pipe, strerror(errno), errno);
return 0;
}
freerdp_add_signal_cleanup_handler(pipe, cleanup_pipe);
xf_process_pipe(context, pipe);
freerdp_del_signal_cleanup_handler(pipe, cleanup_pipe);
unlink(pipe);
return 0;
}