cups/cups-str3425.patch

119 lines
3.8 KiB
Diff
Raw Normal View History

diff -up cups-1.4.2/scheduler/job.c.str3425 cups-1.4.2/scheduler/job.c
--- cups-1.4.2/scheduler/job.c.str3425 2009-12-23 11:00:06.070056898 +0000
+++ cups-1.4.2/scheduler/job.c 2009-12-23 11:02:22.889056232 +0000
@@ -253,7 +253,7 @@ cupsdCancelJobs(const char *dest, /* I -
if (purge)
cupsdSetJobState(job, IPP_JOB_CANCELED, CUPSD_JOB_PURGE,
"Job purged by user.");
- else
+ else if (job->state_value < IPP_JOB_CANCELED)
cupsdSetJobState(job, IPP_JOB_CANCELED, CUPSD_JOB_DEFAULT,
"Job canceled by user.");
}
@@ -433,11 +433,11 @@ cupsdCleanJobs(void)
cupsd_job_t *job; /* Current job */
- if (MaxJobs <= 0)
+ if (MaxJobs <= 0 && JobHistory)
return;
for (job = (cupsd_job_t *)cupsArrayFirst(Jobs);
- job && cupsArrayCount(Jobs) >= MaxJobs;
+ job && (cupsArrayCount(Jobs) >= MaxJobs || !JobHistory);
job = (cupsd_job_t *)cupsArrayNext(Jobs))
if (job->state_value >= IPP_JOB_CANCELED && !job->printer)
cupsdDeleteJob(job, CUPSD_JOB_PURGE);
@@ -2498,8 +2498,6 @@ cupsdSetJobState(
job->dirty = 1;
cupsdMarkDirty(CUPSD_DIRTY_JOBS);
}
- else if (!job->printer)
- cupsdDeleteJob(job, CUPSD_JOB_PURGE);
break;
}
@@ -2507,7 +2505,7 @@ cupsdSetJobState(
* Finalize the job immediately if we forced things...
*/
- if (action == CUPSD_JOB_FORCE)
+ if (action >= CUPSD_JOB_FORCE && job->printer)
finalize_job(job);
/*
diff -up cups-1.4.2/scheduler/main.c.str3425 cups-1.4.2/scheduler/main.c
--- cups-1.4.2/scheduler/main.c.str3425 2009-12-23 11:00:05.687056970 +0000
+++ cups-1.4.2/scheduler/main.c 2009-12-23 11:00:06.156057773 +0000
@@ -389,7 +389,7 @@ main(int argc, /* I - Number of comm
* parent's file descriptors to be blocking. This is a workaround for a
* limitation of userland libpthread on OpenBSD.
*/
-
+
_thread_sys_closefrom(0);
#endif /* __OpenBSD__ */
@@ -817,8 +817,8 @@ main(int argc, /* I - Number of comm
if (timeout == 86400 && Launchd && LaunchdTimeout && !NumPolled &&
!cupsArrayCount(ActiveJobs) &&
- (!Browsing ||
- (!BrowseRemoteProtocols &&
+ (!Browsing ||
+ (!BrowseRemoteProtocols &&
(!NumBrowsers || !BrowseLocalProtocols ||
cupsArrayCount(Printers) == 0))))
{
@@ -1046,6 +1046,7 @@ main(int argc, /* I - Number of comm
if ((current_time - senddoc_time) >= 10)
{
cupsdCheckJobs();
+ cupsdCleanJobs();
senddoc_time = current_time;
}
@@ -1204,8 +1205,8 @@ main(int argc, /* I - Number of comm
#endif /* HAVE_GSSAPI */
#if defined(__APPLE__) && defined(HAVE_DLFCN_H)
- /*
- * Unload Print Service quota enforcement library (X Server only)
+ /*
+ * Unload Print Service quota enforcement library (X Server only)
*/
PSQUpdateQuotaProc = NULL;
@@ -1562,13 +1563,13 @@ launchd_checkin(void)
if (lis)
{
- cupsdLogMessage(CUPSD_LOG_DEBUG,
+ cupsdLogMessage(CUPSD_LOG_DEBUG,
"launchd_checkin: Matched existing listener %s with fd %d...",
httpAddrString(&(lis->address), s, sizeof(s)), fd);
}
else
{
- cupsdLogMessage(CUPSD_LOG_DEBUG,
+ cupsdLogMessage(CUPSD_LOG_DEBUG,
"launchd_checkin: Adding new listener %s with fd %d...",
httpAddrString(&addr, s, sizeof(s)), fd);
@@ -1622,12 +1623,12 @@ launchd_checkout(void)
/*
* Create or remove the launchd KeepAlive file based on whether
- * there are active jobs, polling, browsing for remote printers or
+ * there are active jobs, polling, browsing for remote printers or
* shared printers to advertise...
*/
- if ((cupsArrayCount(ActiveJobs) || NumPolled ||
- (Browsing &&
+ if ((cupsArrayCount(ActiveJobs) || NumPolled ||
+ (Browsing &&
(BrowseRemoteProtocols ||
(BrowseLocalProtocols && NumBrowsers && cupsArrayCount(Printers))))))
{