Blame SOURCES/0001-cups-dests.c-cupsGetNamedDest-set-IPP_STATUS_ERROR_N.patch

a17bb8
From 4ddeb8544e2e5c63a405d9e093ac24704f3deb03 Mon Sep 17 00:00:00 2001
a17bb8
From: Zdenek Dohnal <zdohnal@redhat.com>
a17bb8
Date: Tue, 21 Jul 2020 12:54:22 +0200
a17bb8
Subject: [PATCH] cups/dests.c: cupsGetNamedDest() - set
a17bb8
 IPP_STATUS_ERROR_NOT_FOUND error if queue was not found lp.c/lpr.c: check for
a17bb8
 IPP_STATUS_ERROR_NOT_FOUND and generate a proper message if hit
a17bb8
a17bb8
---
a17bb8
 berkeley/lpr.c | 6 ++++++
a17bb8
 cups/dest.c    | 3 +++
a17bb8
 systemv/lp.c   | 6 ++++++
a17bb8
 3 files changed, 15 insertions(+)
a17bb8
a17bb8
diff --git a/berkeley/lpr.c b/berkeley/lpr.c
a17bb8
index 627fa6a4e..a8f78b881 100644
a17bb8
--- a/berkeley/lpr.c
a17bb8
+++ b/berkeley/lpr.c
a17bb8
@@ -234,6 +234,12 @@ main(int  argc,				/* I - Number of command-line arguments */
a17bb8
 		_cupsLangPrintf(stderr, _("%s: Error - add '/version=1.1' to server name."), argv[0]);
a17bb8
 		return (1);
a17bb8
 	      }
a17bb8
+	      else if (cupsLastError() == IPP_STATUS_ERROR_NOT_FOUND)
a17bb8
+	      {
a17bb8
+		_cupsLangPrintf(stderr,
a17bb8
+				_("%s: Error - The printer or class does not exist."), argv[0]);
a17bb8
+		return (1);
a17bb8
+	      }
a17bb8
 	      break;
a17bb8
 
a17bb8
 	  case '#' : /* Number of copies */
a17bb8
diff --git a/cups/dest.c b/cups/dest.c
a17bb8
index cde987a09..2017792a7 100644
a17bb8
--- a/cups/dest.c
a17bb8
+++ b/cups/dest.c
a17bb8
@@ -1839,7 +1839,10 @@ cupsGetNamedDest(http_t     *http,	/* I - Connection to server or @code CUPS_HTT
a17bb8
       cupsEnumDests(0, 1000, NULL, 0, 0, (cups_dest_cb_t)cups_name_cb, &data);
a17bb8
 
a17bb8
       if (!data.dest)
a17bb8
+      {
a17bb8
+        _cupsSetError(IPP_STATUS_ERROR_NOT_FOUND, _("The printer or class does not exist."), 1);
a17bb8
         return (NULL);
a17bb8
+      }
a17bb8
 
a17bb8
       dest = data.dest;
a17bb8
     }
a17bb8
diff --git a/systemv/lp.c b/systemv/lp.c
a17bb8
index 298c15825..d918b4b14 100644
a17bb8
--- a/systemv/lp.c
a17bb8
+++ b/systemv/lp.c
a17bb8
@@ -161,6 +161,12 @@ main(int  argc,				/* I - Number of command-line arguments */
a17bb8
 				  "name."), argv[0]);
a17bb8
 		return (1);
a17bb8
 	      }
a17bb8
+	      else if (cupsLastError() == IPP_STATUS_ERROR_NOT_FOUND)
a17bb8
+	      {
a17bb8
+		_cupsLangPrintf(stderr,
a17bb8
+				_("%s: Error - The printer or class does not exist."), argv[0]);
a17bb8
+		return (1);
a17bb8
+	      }
a17bb8
 	      break;
a17bb8
 
a17bb8
 	  case 'f' : /* Form */
a17bb8
-- 
a17bb8
2.31.1
a17bb8