diff options
| author | Keerthi Kondaka <Keerthi.Kondaka@Sun.COM> | 2010-07-06 18:22:03 -0700 |
|---|---|---|
| committer | Keerthi Kondaka <Keerthi.Kondaka@Sun.COM> | 2010-07-06 18:22:03 -0700 |
| commit | 4da0bd731fbee2cfd126b8ad533d26179e6566d1 (patch) | |
| tree | def595982d1123ed378b33c3971b66afa0b39e90 /usr/src | |
| parent | c81f2caad0f273de7fb864eb5045a5c5028dd7cc (diff) | |
| download | illumos-joyent-4da0bd731fbee2cfd126b8ad533d26179e6566d1.tar.gz | |
6946115 lpstat -o <remote jobID> return bad-argument error even when jobID is valid
Diffstat (limited to 'usr/src')
| -rw-r--r-- | usr/src/lib/print/libpapi-lpd/common/lpd-query.c | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/usr/src/lib/print/libpapi-lpd/common/lpd-query.c b/usr/src/lib/print/libpapi-lpd/common/lpd-query.c index 89e49dc5f7..964023c919 100644 --- a/usr/src/lib/print/libpapi-lpd/common/lpd-query.c +++ b/usr/src/lib/print/libpapi-lpd/common/lpd-query.c @@ -20,9 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - * + * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. */ /* $Id: lpd-query.c 155 2006-04-26 02:34:54Z ktou $ */ @@ -404,12 +402,17 @@ cache_update(service_t *svc) { int fd; - if (svc->cache != NULL) /* this should be time based */ - return; - if (svc == NULL) return; + if (svc->cache != NULL) { /* this should be time based */ + if (svc->cache->jobs == NULL) { + free(svc->cache); + svc->cache = NULL; + } else + return; + } + if ((fd = lpd_open(svc, 'q', NULL, 15)) < 0) return; @@ -451,6 +454,17 @@ lpd_find_jobs_info(service_t *svc, job_t ***jobs) } } + /* + * cache jobs is free()-ed in + * libpapi-dynamic/common/printer.c - + * papiPrinterListJobs() cache printer is + * free()-ed by the caller of + * lpd_find_printer_info Invalidate the + * cache by freeing the cache. + */ + free(svc->cache); + svc->cache = NULL; + return (result); } @@ -460,7 +474,7 @@ lpd_find_job_info(service_t *svc, int job_id, job_t **job) papi_status_t result = PAPI_BAD_ARGUMENT; job_t **jobs; - if (lpd_find_jobs_info(svc, &jobs) != PAPI_OK) { + if ((lpd_find_jobs_info(svc, &jobs) == PAPI_OK) && (jobs != NULL)) { int i; *job = NULL; |
