From 66e781741ed4e28fe505762e1d53b6fc464d2d1f Mon Sep 17 00:00:00 2001 From: Alexander Aring Date: Jul 14 2020 18:14:16 +0000 Subject: dlm_controld: get notice about failed config parse This patch adds more log_error() functionality in cases if parsing of key value pairs fails so the user get notice about it. --- diff --git a/dlm_controld/config.c b/dlm_controld/config.c index 323f91e..947480d 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); }