Skip to content

Commit 141153e

Browse files
committed
Add a temporary queue before setting the defaults for lpoptions (Issue #833)
1 parent 96a330d commit 141153e

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Changes in CUPS v2.4.11 (YYYY-MM-DD)
66
------------------------------------
77

88
- Updated the maximum file descriptor limit for `cupsd` to 64k-1 (Issue #989)
9+
- Fixed `lpoptions -d` with a discovered but not added printer (Issue #833)
910
- Fixed incorrect error message for HTTP/IPP errors (Issue #893)
1011
- Fixed JobPrivateAccess and SubscriptionPrivateAccess support for "all"
1112
(Issue #990)

cups/dest.c

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2058,6 +2058,35 @@ cupsSetDests2(http_t *http, /* I - Connection to server or @code CUPS_HTTP_
20582058
if (!num_dests || !dests)
20592059
return (-1);
20602060

2061+
/*
2062+
* See if the default destination has a printer URI associated with it...
2063+
*/
2064+
2065+
if ((dest = cupsGetDest(/*name*/NULL, /*instance*/NULL, num_dests, dests)) != NULL && !cupsGetOption("printer-uri-supported", dest->num_options, dest->options))
2066+
{
2067+
/*
2068+
* No, try adding it...
2069+
*/
2070+
2071+
const char *uri; /* Device/printer URI */
2072+
2073+
if ((uri = cupsGetOption("device-uri", dest->num_options, dest->options)) != NULL)
2074+
{
2075+
char tempresource[1024]; /* Temporary resource path */
2076+
2077+
#ifdef HAVE_DNSSD
2078+
if (strstr(uri, "._tcp"))
2079+
uri = cups_dnssd_resolve(dest, uri, /*msec*/30000, /*cancel*/NULL, /*cb*/NULL, /*user_data*/NULL);
2080+
#endif /* HAVE_DNSSD */
2081+
2082+
if (uri)
2083+
uri = _cupsCreateDest(dest->name, cupsGetOption("printer-info", dest->num_options, dest->options), NULL, uri, tempresource, sizeof(tempresource));
2084+
2085+
if (uri)
2086+
dest->num_options = cupsAddOption("printer-uri-supported", uri, dest->num_options, &dest->options);
2087+
}
2088+
}
2089+
20612090
/*
20622091
* Get the server destinations...
20632092
*/

0 commit comments

Comments
 (0)