diff options
| author | jvoisin | 2017-12-04 16:09:50 +0100 |
|---|---|---|
| committer | jvoisin | 2017-12-04 16:09:50 +0100 |
| commit | 32476340c5fd3c76b86487a92fd5c5075342ca99 (patch) | |
| tree | 0d5de876ae0d3e19544dfcbb3454218aa8654aac /src/sp_config_utils.c | |
| parent | 2e9d73756cff850569bdbf563815f9f3f3ded06e (diff) | |
Fix the configuration parser wrt. non-matching brackets
This validation step is a bit idiotic, but we'll replace it with a
proper parser anyway.
Diffstat (limited to 'src/sp_config_utils.c')
| -rw-r--r-- | src/sp_config_utils.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/sp_config_utils.c b/src/sp_config_utils.c index 71dd373..1a797e5 100644 --- a/src/sp_config_utils.c +++ b/src/sp_config_utils.c | |||
| @@ -20,7 +20,12 @@ static int validate_str(const char *value) { | |||
| 20 | return -1; | 20 | return -1; |
| 21 | } | 21 | } |
| 22 | } | 22 | } |
| 23 | return balance != 0; | 23 | if (balance != 0) { |
| 24 | sp_log_err("config", "You forgot to close %d bracket%c in the string '%s'", | ||
| 25 | balance, (balance>1)?'s':' ', value); | ||
| 26 | return -1; | ||
| 27 | } | ||
| 28 | return 0; | ||
| 24 | } | 29 | } |
| 25 | 30 | ||
| 26 | int parse_keywords(sp_config_functions *funcs, char *line) { | 31 | int parse_keywords(sp_config_functions *funcs, char *line) { |
| @@ -112,7 +117,7 @@ err: | |||
| 112 | sp_log_err("error", | 117 | sp_log_err("error", |
| 113 | "There is an issue with the parsing of '%s': it doesn't look like a valid string on line %zu.", | 118 | "There is an issue with the parsing of '%s': it doesn't look like a valid string on line %zu.", |
| 114 | original_line ? original_line : "NULL", sp_line_no); | 119 | original_line ? original_line : "NULL", sp_line_no); |
| 115 | } | 120 | } |
| 116 | line = NULL; | 121 | line = NULL; |
| 117 | return NULL; | 122 | return NULL; |
| 118 | } | 123 | } |
