[cups.bugs] Fix won't work
Bertram Scharpf
info at bertram-scharpf.de
Wed Dec 31 11:01:16 PST 2008
Hi Cupsers,
in June, I filed a feature request:
<http://marc.info/?l=cups&m=121227990618931&w=2>
<http://www.cups.org/str.php?L2857+P0+S-2+C0+I0+E0+M20+Qbackend+socket+>
Now in version 1.3.9, I find a corrected version of the file
<backend/socket.c>. Here are the lines 393-396:
wait_time = time(NULL) + 5;
while (wait_time >= time(¤t_time))
if (wait_bc(device_fd, wait_time - current_time) <= 0)
break;
This is very difficult for me to test as I have to wait for the
next time when a vast number of documents is to be printed and
then I would have to disturb the girls in the office who just want
to do their work. Therefore I try to examine the code instead of
executing it.
The above is the same as:
wait_time = time( NULL) + 5;
while (wait_time - time( ¤t_time) >= 0)
if (wait_bc( device_fd, wait_time - current_time) <= 0)
break;
Now I save the difference into a variable:
wait_time = time( NULL) + 5;
while ((t = wait_time - time( ¤t_time)) >= 0)
if (wait_bc(device_fd, t) <= 0)
break;
The current_time variable can be eliminated:
wait_time = time( NULL) + 5;
while ((t = wait_time - time( NULL)) >= 0)
if (wait_bc(device_fd, t) <= 0)
break;
Further the break statement can be replaced by a longer while
condition:
wait_time = time( NULL) + 5;
while ((t = wait_time - time( NULL)) >= 0 && wait_bc(device_fd, t) > 0)
;
In the case the queue won't be empty after five seconds this
aborts. My problem though was that the wait happens for 5 seconds
even if the queue is empty. Obviously the while condition will be
entered twice: The first time t is 5, the second time it is
probably -1. I transform it another time:
while ((t = 5) >= 0 && wait_bc(device_fd, t) > 0)
;
while ((t = -1) >= 0 && wait_bc(device_fd, t) > 0)
;
Or
while (wait_bc(device_fd, 5) > 0)
;
This is just what the 1.3.8 version did. Therefore I seriously
doubt whether your fix will solve the problem.
If this is not your opinion, I will try to execute the unpatched
code. Please leave me a short note what you are inclined to do.
Thaks in advance.
Regards,
Bertram
--
Bertram Scharpf
Bopserstraße 15, D-70180 Stuttgart
Ruf 0711/2599337, Fax 0711/2184509 [13*79*2531,prim]
http://www.bertram-scharpf.de
More information about the cups-devel
mailing list