summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Untz <vuntz@novell.com>2008-11-20 23:23:07 +0100
committerVincent Untz <vuntz@novell.com>2008-11-20 23:23:07 +0100
commitdcd1731d6f017664224db217475b0b6fbac3118b (patch)
tree10af253704f2bccd65bc8b855db60b439317dd14
parentb4d43606c097be18c54b504346f8eb475757de9a (diff)
Fix a bug where most of the changes to a printer didn't work.
A lot of changes are done by sending a new PPD file. And it didn't work because we were sending it with an empty URI (instead of no URI).
-rw-r--r--src/cups.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/cups.c b/src/cups.c
index cb2d592..e1027c9 100644
--- a/src/cups.c
+++ b/src/cups.c
@@ -738,8 +738,14 @@ cph_cups_printer_add_with_ppd_file (CphCups *cups,
ippAddString (request, IPP_TAG_PRINTER, IPP_TAG_NAME,
"printer-name", NULL, printer_name);
- ippAddString (request, IPP_TAG_PRINTER, IPP_TAG_URI,
- "device-uri", NULL, printer_uri);
+
+ /* In this specific case of ADD_MODIFY, the URI can be NULL/empty since
+ * we provide a complete PPD. And cups fails if we pass an empty
+ * string. */
+ if (printer_uri && printer_uri[0] != '\0') {
+ ippAddString (request, IPP_TAG_PRINTER, IPP_TAG_URI,
+ "device-uri", NULL, printer_uri);
+ }
if (info && info[0] != '\0') {
ippAddString (request, IPP_TAG_PRINTER, IPP_TAG_TEXT,