summaryrefslogtreecommitdiff
path: root/usr/src/cmd/print/bsd-sysv-commands/lpstat.c
diff options
context:
space:
mode:
authorsonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>2009-04-09 23:37:50 -0700
committersonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>2009-04-09 23:37:50 -0700
commitf0b87b902adb4cdfe4ad24ea596a7311ddbb2953 (patch)
treedf5d3435e267baa0cf0483c2ca43b499f51514b8 /usr/src/cmd/print/bsd-sysv-commands/lpstat.c
parent40e7ce05bde825a43b0db32ded62db8cc5b6ec9c (diff)
downloadillumos-joyent-f0b87b902adb4cdfe4ad24ea596a7311ddbb2953.tar.gz
6815222 lpstat -o reports incorrect job# for general user
Diffstat (limited to 'usr/src/cmd/print/bsd-sysv-commands/lpstat.c')
-rw-r--r--usr/src/cmd/print/bsd-sysv-commands/lpstat.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/usr/src/cmd/print/bsd-sysv-commands/lpstat.c b/usr/src/cmd/print/bsd-sysv-commands/lpstat.c
index 94c3b7b98f..789661b2e0 100644
--- a/usr/src/cmd/print/bsd-sysv-commands/lpstat.c
+++ b/usr/src/cmd/print/bsd-sysv-commands/lpstat.c
@@ -797,6 +797,7 @@ report_job(char *printer, papi_job_t job, int show_rank, int verbose)
(void) papiAttributeListGetInteger(attrs, NULL,
"job-id-requested", &id);
+
snprintf(request, sizeof (request), "%s-%d", printer, id);
if (show_rank != 0) {
@@ -813,6 +814,7 @@ report_job(char *printer, papi_job_t job, int show_rank, int verbose)
(void) papiAttributeListGetInteger(attrs, NULL,
"job-state", &jstate);
+
if (jstate == 0x0001)
printf(gettext(" being held"));
else if (jstate == 0x0800)
@@ -930,11 +932,22 @@ job_query(char *request, int (*report)(char *, papi_job_t, int, int),
papiJobListFree(jobs);
} else { /* a job */
papi_job_t job = NULL;
+ int rid = id;
/* Once a job has been found stop processing */
flag = 0;
- status = papiJobQuery(svc, printer, id, NULL, &job);
+ /*
+ * Job-id could be the job-id requested
+ * Check if it is job-id or job-id-requested
+ */
+ id = job_to_be_queried(svc, printer, id);
+
+ if (id > 0)
+ status = papiJobQuery(svc, printer, id, NULL, &job);
+ else
+ status = papiJobQuery(svc, printer, rid, NULL, &job);
+
if (status != PAPI_OK) {
if (!print_flag)
fprintf(stderr, gettext(