From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 123767 invoked by alias); 7 Nov 2017 18:17:39 -0000 Mailing-List: contact cygwin-apps-help@cygwin.com; run by ezmlm Precedence: bulk Sender: cygwin-apps-owner@cygwin.com List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Mail-Followup-To: cygwin-apps@cygwin.com Received: (qmail 123566 invoked by uid 89); 7 Nov 2017 18:17:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-23.9 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy=cap, greater, site X-HELO: rgout02.bt.lon5.cpcloud.co.uk Received: from rgout0202.bt.lon5.cpcloud.co.uk (HELO rgout02.bt.lon5.cpcloud.co.uk) (65.20.0.201) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 07 Nov 2017 18:17:37 +0000 X-OWM-Source-IP: 86.162.230.154 (GB) X-OWM-Env-Sender: jonturney@btinternet.com X-Junkmail-Premium-Raw: score=7/50,refid=2.7.2:2017.11.7.174516:17:7.944,ip=,rules=__HAS_FROM, __TO_MALFORMED_2, __TO_NO_NAME, __HAS_CC_HDR, __CC_NAME, __CC_NAME_DIFF_FROM_ACC, __SUBJ_ALPHA_END, __HAS_MSGID, __SANE_MSGID, __HAS_X_MAILER, __IN_REP_TO, __REFERENCES, __FROM_DOMAIN_IN_ANY_CC1, __NO_HTML_TAG_RAW, BODY_SIZE_3000_3999, __MIME_TEXT_P1, __MIME_TEXT_ONLY, HTML_00_01, HTML_00_10, BODY_SIZE_5000_LESS, IN_REP_TO, MSG_THREAD, __FROM_DOMAIN_IN_RCPT, __CC_REAL_NAMES, MULTIPLE_REAL_RCPTS, LEGITIMATE_SIGNS, NO_URI_FOUND, NO_CTA_URI_FOUND, __MIME_TEXT_P, REFERENCES, NO_URI_HTTPS, BODY_SIZE_7000_LESS Received: from localhost.localdomain (86.162.230.154) by rgout02.bt.lon5.cpcloud.co.uk (9.0.019.13-1) (authenticated as jonturney@btinternet.com) id 59D91D94034C7949; Tue, 7 Nov 2017 18:17:35 +0000 From: Jon Turney To: cygwin-apps@cygwin.com Cc: Jon Turney Subject: [PATCH setup 1/5] Make do_ini() succeed if found_ini_list is empty Date: Tue, 07 Nov 2017 18:17:00 -0000 Message-Id: <20171107181703.51016-1-jon.turney@dronecode.org.uk> In-Reply-To: References: X-SW-Source: 2017-11/txt/msg00020.txt.bz2 Rather than count the number of .ini files read in do_{local,remote}_ini, and assume success if greater than zero, actually track if an error occured. This is a subtle change of behaviour if more than one .ini file is read: previously all we needed was one to succeed, now we need them all to succeed. (Note that site_list should never be empty, and it's still an error if we don't find an .ini file from a site, to the practical effect is to make do_local_ini with an empty found_ini_list succeed) --- ini.cc | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/ini.cc b/ini.cc index 0f8b927..85325c3 100644 --- a/ini.cc +++ b/ini.cc @@ -205,10 +205,10 @@ check_ini_sig (io_stream* ini_file, io_stream* ini_sig_file, return ini_file; } -static int +static bool do_local_ini (HWND owner) { - size_t ini_count = 0; + bool ini_error = false; GuiParseFeedback myFeedback; IniDBBuilderPackage aBuilder (myFeedback); io_stream *ini_file, *ini_sig_file; @@ -233,6 +233,7 @@ do_local_ini (HWND owner) // no setup found or signature invalid note (owner, IDS_SETUPINI_MISSING, SetupBaseName.c_str (), "localdir"); + ini_error = true; } else { @@ -245,12 +246,11 @@ do_local_ini (HWND owner) rfc1738_unescape (current_ini_name.substr (ldl, cap - ldl)); ini_init (ini_file, &aBuilder, myFeedback); - /*yydebug = 1; */ - if (yyparse () || yyerror_count > 0) - myFeedback.error (yyerror_messages); - else - ++ini_count; + { + myFeedback.error (yyerror_messages); + ini_error = true; + } if (aBuilder.timestamp > setup_timestamp) { @@ -261,13 +261,13 @@ do_local_ini (HWND owner) ini_file = NULL; } } - return ini_count; + return ini_error; } -static int +static bool do_remote_ini (HWND owner) { - size_t ini_count = 0; + bool ini_error = false; GuiParseFeedback myFeedback; IniDBBuilderPackage aBuilder (myFeedback); io_stream *ini_file = NULL, *ini_sig_file; @@ -303,6 +303,7 @@ do_remote_ini (HWND owner) { // no setup found or signature invalid note (owner, IDS_SETUPINI_MISSING, SetupBaseName.c_str (), n->url.c_str ()); + ini_error = true; } else { @@ -311,10 +312,11 @@ do_remote_ini (HWND owner) aBuilder.parse_mirror = n->url; ini_init (ini_file, &aBuilder, myFeedback); - /*yydebug = 1; */ - if (yyparse () || yyerror_count > 0) - myFeedback.error (yyerror_messages); + { + myFeedback.error (yyerror_messages); + ini_error = true; + } else { /* save known-good setup.ini locally */ @@ -329,7 +331,6 @@ do_remote_ini (HWND owner) io_stream::remove (fp); delete out; } - ++ini_count; } if (aBuilder.timestamp > setup_timestamp) { @@ -340,19 +341,19 @@ do_remote_ini (HWND owner) ini_file = NULL; } } - return ini_count; + return ini_error; } static bool do_ini_thread (HINSTANCE h, HWND owner) { - size_t ini_count = 0; + bool ini_error = true; if (source == IDC_SOURCE_LOCALDIR) - ini_count = do_local_ini (owner); + ini_error = do_local_ini (owner); else - ini_count = do_remote_ini (owner); + ini_error = do_remote_ini (owner); - if (ini_count == 0) + if (ini_error) return false; if (get_root_dir ().c_str ()) -- 2.15.0