cups/dest.c: Look for default printer on network as well
The current code of `cupsGetNamedDest()` doesn't look up on network for
a default printer. The result is a temporary queue cannot be set as a
default printer.
Fixes
@@ -1835,31 +1835,22 @@ cupsGetNamedDest(http_t *http, /* I - Connection to server or @code CUPS_HTT
*/
if (!_cupsGetDests(http, op, dest_name, &dest, 0, 0))
- {
- if (name)
{
_cups_namedata_t data; /* Callback data */
DEBUG_puts("1cupsGetNamedDest: No queue found for printer, looking on network...");
- data.name = name;
+ data.name = dest_name;
data.dest = NULL;
cupsEnumDests(0, 1000, NULL, 0, 0, (cups_dest_cb_t)cups_name_cb, &data);
if (!data.dest)
- {
- _cupsSetError(IPP_STATUS_ERROR_NOT_FOUND, _("The printer or class does not exist."), 1);
- return (NULL);
- }
-
- dest = data.dest;
- }
- else
{
switch (set_as_default)
{
default :
+ _cupsSetError(IPP_STATUS_ERROR_NOT_FOUND, _("The printer or class does not exist."), 1);
break;
case 1 : /* Set from env vars */
@@ -1886,6 +1877,8 @@ cupsGetNamedDest(http_t *http, /* I - Connection to server or @code CUPS_HTT
return (NULL);
}
+
+ dest = data.dest;
}
DEBUG_printf(("1cupsGetNamedDest: Got dest=%p", (void *)dest));
