]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Rearranging order of null checks in lpadmin 5155/head
authorDavieV <davidvalleau@gmail.com>
Thu, 26 Oct 2017 05:29:01 +0000 (22:29 -0700)
committerDavieV <davidvalleau@gmail.com>
Thu, 26 Oct 2017 05:29:01 +0000 (22:29 -0700)
systemv/lpadmin.c

index f9a1970b5c704d515251402b395486b694832616..c608c2d30f01451e995eb8c732040be154f16441 100644 (file)
@@ -601,27 +601,26 @@ main(int  argc,                   /* I - Number of command-line arguments */
 
   if (num_options || file)
   {
-    if (!http)
-    {
-      http = httpConnect2(cupsServer(), ippPort(), NULL, AF_UNSPEC, cupsEncryption(), 1, 30000, NULL);
-
-      if (http == NULL)
-      {
-       _cupsLangPrintf(stderr,
-                       _("lpadmin: Unable to connect to server: %s"),
-                       strerror(errno));
-       return (1);
-      }
-    }
-
     if (printer == NULL)
     {
       _cupsLangPuts(stderr,
                     _("lpadmin: Unable to set the printer options:\n"
-                     "         You must specify a printer name first."));
+                      "         You must specify a printer name first."));
       return (1);
     }
 
+    if (!http)
+    {
+      http = httpConnect2(cupsServer(), ippPort(), NULL, AF_UNSPEC,
+                          cupsEncryption(), 1, 30000, NULL);
+
+      if (http == NULL) {
+        _cupsLangPrintf(stderr, _("lpadmin: Unable to connect to server: %s"),
+                        strerror(errno));
+        return (1);
+      }
+    }
+
     if (set_printer_options(http, printer, num_options, options, file))
       return (1);
   }