From 178f07da98f4e2d11816de00d0066a5b75446632 Mon Sep 17 00:00:00 2001 From: Rose <83477269+AtariDreams@users.noreply.github.com> Date: Fri, 11 Nov 2022 10:31:06 -0500 Subject: [PATCH] Fix backchannel status checking bugs Checking for merely (status < 0) is a bug because the check for timeout is deliberate. Note that you have an if (timeout < 0) at the beginning So if the timeout is set to a value, it should check for that value. Co-Authored-By: aaaaaa123456789 --- cups/backchannel.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cups/backchannel.c b/cups/backchannel.c index 916c314337..77ad60eab1 100644 --- a/cups/backchannel.c +++ b/cups/backchannel.c @@ -65,7 +65,7 @@ cupsBackChannelRead(char *buffer, /* I - Buffer to read into */ } while (status < 0 && errno != EINTR && errno != EAGAIN); - if (status < 0) + if (status <= 0) return (-1); /* Timeout! */ /* @@ -173,8 +173,8 @@ cups_setup(fd_set *set, /* I - Set for select() */ struct timeval *tval, /* I - Timer value */ double timeout) /* I - Timeout in seconds */ { - tval->tv_sec = (int)timeout; - tval->tv_usec = (int)(1000000.0 * (timeout - tval->tv_sec)); + tval->tv_sec = (time_t)timeout; + tval->tv_usec = (suseconds_t)(1000000.0 * (timeout - tval->tv_sec)); FD_ZERO(set); FD_SET(3, set); -- 2.47.2