X-Git-Url: http://git.ipfire.org/?p=thirdparty%2Fcups.git;a=blobdiff_plain;f=backend%2Fsocket.c;h=70a0891954918059b1e774de9fdacf1d4a35f593;hp=4e2dac1463304a7d039aaff72d595e2714ec721e;hb=5f64df29828e9ca71164342efd357e9debfb6e44;hpb=247efae55fc4aeeb5ab97fd3e8e56fc9cd4b0706;ds=sidebyside diff --git a/backend/socket.c b/backend/socket.c index 4e2dac146..70a089195 100644 --- a/backend/socket.c +++ b/backend/socket.c @@ -72,7 +72,8 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ sep; /* Option separator */ int print_fd; /* Print file */ int copies; /* Number of copies to print */ - time_t start_time; /* Time of first connect */ + time_t start_time, /* Time of first connect */ + wait_time; /* Time to wait before shutting down socket */ int recoverable; /* Recoverable error shown? */ int contimeout; /* Connection timeout */ int waiteof; /* Wait for end-of-file? */ @@ -412,10 +413,13 @@ main(int argc, /* I - Number of command-line arguments (6 or 7) */ } /* - * Get any pending back-channel data... + * Wait up to 5 seconds to get any pending back-channel data... */ - while (wait_bc(device_fd, 5) > 0); + wait_time = time(NULL) + 5; + while (wait_time >= time(NULL)) + if (wait_bc(device_fd, 1) <= 0) + break; if (waiteof) {