From: Alexander Aring <aahringo@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH dlm-tool 4/4] dlm_controld: get notice about failed config parse
Date: Tue, 14 Jul 2020 14:01:16 -0400 [thread overview]
Message-ID: <20200714180116.18642-5-aahringo@redhat.com> (raw)
In-Reply-To: <20200714180116.18642-1-aahringo@redhat.com>
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
prev parent reply other threads:[~2020-07-14 18:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-14 18:01 [Cluster-devel] [PATCH dlm-tool 0/4] dlm_controld: gcc-10 compile warning fixes Alexander Aring
2020-07-14 18:01 ` [Cluster-devel] [PATCH dlm-tool 1/4] dlm_controld: fix -Wstringop-truncation warnings Alexander Aring
2020-07-14 18:01 ` [Cluster-devel] [PATCH dlm-tool 2/4] dlm_controld: fix may be used uninitialized Alexander Aring
2020-07-14 18:01 ` [Cluster-devel] [PATCH dlm-tool 3/4] " Alexander Aring
2020-07-14 18:01 ` Alexander Aring [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200714180116.18642-5-aahringo@redhat.com \
--to=aahringo@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).