From f9ee3b81e100f0923574d10adc4bb51e88ccf8df Mon Sep 17 00:00:00 2001 From: DavieV Date: Wed, 25 Oct 2017 22:29:01 -0700 Subject: [PATCH] Rearranging order of null checks in lpadmin --- systemv/lpadmin.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/systemv/lpadmin.c b/systemv/lpadmin.c index f9a1970b5c..c608c2d30f 100644 --- a/systemv/lpadmin.c +++ b/systemv/lpadmin.c @@ -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); } -- 2.47.3