[cups.bugs] [HIGH] STR #3107: cupsGetJobs() returns error "The printer or class was not found."
John A. Murdie
john at cs.york.ac.uk
Thu Feb 19 10:30:06 PST 2009
DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.
[STR New]
I've a little program running as root whose job it is to call
cupsGetJobs(&jobs, NULL, 0, CUPS_WHICHJOBS_ALL) once an hour and call
cupsCancelJob() for any job which has been held for 24 hours or more.
(This to keep our job queue clean.) It works fine with 1.3.*, but for a
1.4b2 test installation I'm getting the return value -1 and the error "The
printer or class was not found."
The source code in question is:
/* Cancel any jobs which have been held for more than the configured
* maximum hold time. E-mail the user to tell them what has happened.
*/
age = printerconfig[maxJobHoldDuration].i;
firsttime = time(NULL) - age;
num_jobs = cupsGetJobs(&jobs, NULL, 0, CUPS_WHICHJOBS_COMPLETED);
startlogline(level(printerconfig[logLevel].s), debug,"num_jobs %d\n",
num_jobs);
if (num_jobs >= 0) {
for (i = 0, job = jobs; i < num_jobs; i++, job++)
if (job->state == IPP_JOB_HELD && job->creation_time < firsttime) {
startlogline(level(printerconfig[logLevel].s), info,
"Canceling %s-%d (%s) queued by %s at %d ...\n",
job->dest, job->id, job->title, job->user,
toisotime(job->creation_time, isotimebuf));
cupsCancelJob(job->dest, job->id);
informuser(level(printerconfig[logLevel].s),
printerconfig[sendmailPath].s,
job->user, job->dest, job->id, job->title,
printerconfig[describeMaxDuration].s,
printerconfig[chargeDocURL].s,
printerconfig[CUPSJobsPageURL].s,
printerconfig[supportEmail].s);
}
cupsFreeJobs(num_jobs, jobs);
} else
startlogline(level(printerconfig[logLevel].s), info,
"cupsGetJobs() returns num_jobs %d error \"%s\"\n", num_jobs,
cupsLastErrorString());
John A. Murdie
Link: http://www.cups.org/str.php?L3107
Version: 1.4b2
More information about the cups-devel
mailing list