From 3ff5a8e3932907c5794165b27ecefa1e8d7b1321 Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Thu, 14 Nov 2019 13:00:12 -0500 Subject: [PATCH 1/1] Fix lpoptions defaults (Issue #5681) --- CHANGES.md | 1 + cups/dest.c | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 779ac3321..e80ca4cc1 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -17,6 +17,7 @@ Changes in CUPS v2.3.1 - Added paint can labels to Dymo driver (Issue #5662) - The `--with-dbusdir` option was ignored by the configure script (Issue #5671) - Log file access controls were not preserved by `cupsctl` (Issue #5677) +- Default printers set with `lpoptions` did not work in all cases (Issue #5681) - The IPP backend did not detect all cases where a job should be retried using a raster format (rdar://56021091) - Fixed spelling of "fold-accordion". diff --git a/cups/dest.c b/cups/dest.c index 17d96fe4a..6ddfe9a36 100644 --- a/cups/dest.c +++ b/cups/dest.c @@ -3482,6 +3482,16 @@ cups_enum_dests( data.num_dests = cups_get_dests(filename, NULL, NULL, 1, user_default != NULL, data.num_dests, &data.dests); } + if (!data.def_name[0] && (user_dest = cupsGetDest(NULL, NULL, data.num_dests, data.dests)) != NULL) + { + /* + * Use an lpoptions default printer... + */ + + strlcpy(data.def_name, user_dest->name, sizeof(data.def_name)); + data.def_instance = user_dest->instance; + } + /* * Get ready to enumerate... */ -- 2.39.2