From: Bryan Mason Date: Sat, 24 Jun 2023 19:31:23 +0000 (-0700) Subject: Fix delays printing to lpd when reserved ports are exhausted X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d82c43db87ac421ad9830c77342ad68b1d4d20c3;p=thirdparty%2Fcups.git Fix delays printing to lpd when reserved ports are exhausted cups_rresvport() doesn't reserve ports less than 512; however, lpd_queue() continues decrementing the port number to 0. This leads to delays of ~511 seconds once all ports between 512-1023 are exhausted. Even when ports become available, lpd_queue() still tries calling cups_rresvport() with port numbers less than 512, waiting one second between each call. --- diff --git a/backend/lpd.c b/backend/lpd.c index a7a44ab20f..425b8512ac 100644 --- a/backend/lpd.c +++ b/backend/lpd.c @@ -63,7 +63,7 @@ static int abort_job = 0; /* Non-zero if we get SIGTERM */ #define RESERVE_NONE 0 /* Don't reserve a privileged port */ #define RESERVE_RFC1179 1 /* Reserve port 721-731 */ -#define RESERVE_ANY 2 /* Reserve port 1-1023 */ +#define RESERVE_ANY 2 /* Reserve port 512-1023 */ /* @@ -775,7 +775,7 @@ lpd_queue(const char *hostname, /* I - Host to connect to */ if (lport < 721 && reserve == RESERVE_RFC1179) lport = 731; - else if (lport < 1) + else if (lport < 512) lport = 1023; #ifdef HAVE_GETEUID