Skip to content

Commit

Permalink
Add a temporary queue before setting the defaults for lpoptions (Issue
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelrsweet committed Sep 20, 2024
1 parent 0c5ff99 commit 85e977d
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions cups/dest.c
Original file line number Diff line number Diff line change
Expand Up @@ -1960,6 +1960,30 @@ cupsSetDests2(http_t *http, // I - Connection to server or @code CUPS_HTTP_
if (!num_dests || !dests)
return (-1);

//
// See if the default destination has a printer URI associated with it...
//

if ((dest = cupsGetDest(/*name*/NULL, /*instance*/NULL, num_dests, dests)) != NULL && !cupsGetOption("printer-uri-supported", dest->num_options, dest->options))
{
// No, try adding it...
const char *uri; // Device/printer URI

if ((uri = cupsGetOption("device-uri", dest->num_options, dest->options)) != NULL)
{
char tempresource[1024]; // Temporary resource path

if (strstr(uri, "._tcp"))
uri = cups_dest_resolve(dest, uri, /*msec*/30000, /*cancel*/NULL, /*cb*/NULL, /*user_data*/NULL);

if (uri)
uri = _cupsCreateDest(dest->name, cupsGetOption("printer-info", dest->num_options, dest->options), NULL, uri, tempresource, sizeof(tempresource));

if (uri)
dest->num_options = cupsAddOption("printer-uri-supported", uri, dest->num_options, &dest->options);
}
}

//
// Get the server destinations...
//
Expand Down

0 comments on commit 85e977d

Please sign in to comment.