From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexander Aring Date: Tue, 14 Jul 2020 14:01:16 -0400 Subject: [Cluster-devel] [PATCH dlm-tool 4/4] dlm_controld: get notice about failed config parse In-Reply-To: <20200714180116.18642-1-aahringo@redhat.com> References: <20200714180116.18642-1-aahringo@redhat.com> Message-ID: <20200714180116.18642-5-aahringo@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit This patch adds more log_error() functionality in cases if parsing of key value pairs fails so the user get notice about it. --- dlm_controld/config.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/dlm_controld/config.c b/dlm_controld/config.c index 323f91e9..947480da 100644 --- a/dlm_controld/config.c +++ b/dlm_controld/config.c @@ -150,8 +150,10 @@ static void get_val_int(char *line, int *val_out) int rv; rv = sscanf(line, "%[^=]=%s", key, val); - if (rv != 2) + if (rv != 2) { + log_error("Failed to parse config line %s", line); return; + } *val_out = atoi(val); } @@ -163,8 +165,10 @@ static void get_val_uint(char *line, unsigned int *val_out) int rv; rv = sscanf(line, "%[^=]=%s", key, val); - if (rv != 2) + if (rv != 2) { + log_error("Failed to parse config line %s", line); return; + } *val_out = strtoul(val, NULL, 0); } @@ -176,8 +180,10 @@ static void get_val_str(char *line, char *val_out) int rv; rv = sscanf(line, "%[^=]=%s", key, val); - if (rv != 2) + if (rv != 2) { + log_error("Failed to parse config line %s", line); return; + } strcpy(val_out, val); } -- 2.26.2