- Use upstream patch to fix scheduler crash when an active printer was

deleted (rev 8914).
This commit is contained in:
Tim Waugh 2009-12-09 11:39:16 +00:00
parent f5ad921fed
commit d446598d5c
2 changed files with 117 additions and 1 deletions

View File

@ -0,0 +1,110 @@
diff -up cups-1.4.2/CHANGES.txt.delete-active-printer cups-1.4.2/CHANGES.txt
diff -up cups-1.4.2/scheduler/job.c.delete-active-printer cups-1.4.2/scheduler/job.c
--- cups-1.4.2/scheduler/job.c.delete-active-printer 2009-12-09 11:24:50.946891977 +0000
+++ cups-1.4.2/scheduler/job.c 2009-12-09 11:25:32.145892252 +0000
@@ -168,7 +168,7 @@ static mime_filter_t gziptoany_filter =
static int compare_active_jobs(void *first, void *second, void *data);
static int compare_jobs(void *first, void *second, void *data);
static void dump_job_history(cupsd_job_t *job);
-static void finalize_job(cupsd_job_t *job);
+static void finalize_job(cupsd_job_t *job, int set_job_state);
static void free_job_history(cupsd_job_t *job);
static char *get_options(cupsd_job_t *job, int banner_page, char *copies,
size_t copies_size, char *title,
@@ -1297,7 +1297,7 @@ cupsdDeleteJob(cupsd_job_t *job, /
cupsd_jobaction_t action)/* I - Action */
{
if (job->printer)
- finalize_job(job);
+ finalize_job(job, 1);
if (action == CUPSD_JOB_PURGE)
{
@@ -2298,7 +2298,7 @@ cupsdSetJobState(
*/
if (oldstate == IPP_JOB_PROCESSING)
- stop_job(job, action != CUPSD_JOB_DEFAULT);
+ stop_job(job, action);
/*
* Set the new job state...
@@ -2505,8 +2505,8 @@ cupsdSetJobState(
* Finalize the job immediately if we forced things...
*/
- if (action == CUPSD_JOB_FORCE)
- finalize_job(job);
+ if (action >= CUPSD_JOB_FORCE)
+ finalize_job(job, 0);
/*
* Update the server "busy" state...
@@ -2741,7 +2741,8 @@ free_job_history(cupsd_job_t *job) /* I
*/
static void
-finalize_job(cupsd_job_t *job) /* I - Job */
+finalize_job(cupsd_job_t *job, /* I - Job */
+ int set_job_state) /* I - 1 = set the job state */
{
ipp_pstate_t printer_state; /* New printer state value */
ipp_jstate_t job_state; /* New job state value */
@@ -3027,7 +3028,9 @@ finalize_job(cupsd_job_t *job) /* I - J
* Update the printer and job state.
*/
- cupsdSetJobState(job, job_state, CUPSD_JOB_DEFAULT, "%s", message);
+ if (job_state != job->state_value)
+ cupsdSetJobState(job, job_state, CUPSD_JOB_DEFAULT, "%s", message);
+
cupsdSetPrinterState(job->printer, printer_state,
printer_state == IPP_PRINTER_STOPPED);
update_job_attrs(job, 0);
@@ -3995,15 +3998,34 @@ stop_job(cupsd_job_t *job, /* I -
if (action == CUPSD_JOB_DEFAULT && !job->kill_time)
job->kill_time = time(NULL) + JobKillDelay;
- else if (action == CUPSD_JOB_FORCE)
+ else if (action >= CUPSD_JOB_FORCE)
job->kill_time = 0;
for (i = 0; job->filters[i]; i ++)
if (job->filters[i] > 0)
- cupsdEndProcess(job->filters[i], action == CUPSD_JOB_FORCE);
+ {
+ cupsdEndProcess(job->filters[i], action >= CUPSD_JOB_FORCE);
+
+ if (action >= CUPSD_JOB_FORCE)
+ job->filters[i] = -job->filters[i];
+ }
if (job->backend > 0)
- cupsdEndProcess(job->backend, action == CUPSD_JOB_FORCE);
+ {
+ cupsdEndProcess(job->backend, action >= CUPSD_JOB_FORCE);
+
+ if (action >= CUPSD_JOB_FORCE)
+ job->backend = -job->backend;
+ }
+
+ if (action >= CUPSD_JOB_FORCE)
+ {
+ /*
+ * Clear job status...
+ */
+
+ job->status = 0;
+ }
}
@@ -4393,7 +4415,7 @@ update_job(cupsd_job_t *job) /* I - Job
* Handle the end of job stuff...
*/
- finalize_job(job);
+ finalize_job(job, 1);
/*
* Check for new jobs...

View File

@ -9,7 +9,7 @@
Summary: Common Unix Printing System Summary: Common Unix Printing System
Name: cups Name: cups
Version: 1.4.2 Version: 1.4.2
Release: 14%{?dist} Release: 15%{?dist}
License: GPLv2 License: GPLv2
Group: System Environment/Daemons Group: System Environment/Daemons
Source: http://ftp.easysw.com/pub/cups/%{version}/cups-%{version}-source.tar.bz2 Source: http://ftp.easysw.com/pub/cups/%{version}/cups-%{version}-source.tar.bz2
@ -70,6 +70,7 @@ Patch45: cups-str3436.patch
Patch46: cups-str3425.patch Patch46: cups-str3425.patch
Patch47: cups-str3428.patch Patch47: cups-str3428.patch
Patch48: cups-str3431.patch Patch48: cups-str3431.patch
Patch49: cups-delete-active-printer.patch
Patch100: cups-lspp.patch Patch100: cups-lspp.patch
@ -247,6 +248,7 @@ module.
%patch46 -p1 -b .str3425 %patch46 -p1 -b .str3425
%patch47 -p1 -b .str3428 %patch47 -p1 -b .str3428
%patch48 -p1 -b .str3431 %patch48 -p1 -b .str3431
%patch49 -p1 -b .delete-active-printer
%if %lspp %if %lspp
%patch100 -p1 -b .lspp %patch100 -p1 -b .lspp
@ -537,6 +539,10 @@ rm -rf $RPM_BUILD_ROOT
%{php_extdir}/phpcups.so %{php_extdir}/phpcups.so
%changelog %changelog
* Wed Dec 9 2009 Tim Waugh <twaugh@redhat.com> - 1:1.4.2-15
- Use upstream patch to fix scheduler crash when an active printer was
deleted (rev 8914).
* Tue Dec 8 2009 Tim Waugh <twaugh@redhat.com> - 1:1.4.2-14 * Tue Dec 8 2009 Tim Waugh <twaugh@redhat.com> - 1:1.4.2-14
- The scheduler did not use the Get-Job-Attributes policy for a - The scheduler did not use the Get-Job-Attributes policy for a
printer (STR #3431). printer (STR #3431).