From 6aeb03bd071300844cb0712ff0b97c18743ad212 Mon Sep 17 00:00:00 2001 From: Andreas Karlson Date: Tue, 9 Apr 2024 15:14:22 +0200 Subject: [PATCH] scheduler: Fix potential bug when adding new printers (Issue #934) When adding a new printer a thread is created to handle PPD generation, and the requesting client connection might close while the thread is running. This commit prevents full connection cleanup until the thread is finished. --- scheduler/client.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scheduler/client.c b/scheduler/client.c index c13cfbfa58..2dafd93116 100644 --- a/scheduler/client.c +++ b/scheduler/client.c @@ -430,6 +430,14 @@ cupsdCloseClient(cupsd_client_t *con) /* I - Client to close */ con->file = -1; } + if (con->bg_pending) + { + /* + * Don't close connection when there is a background thread pending + */ + partial = 1; + } + /* * Close the socket and clear the file from the input set for select()... */ -- 2.47.2