diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/sp_config_utils.c | 10 | ||||
| -rw-r--r-- | src/tests/broken_conf_invalid_cidr_value.phpt | 4 | ||||
| -rw-r--r-- | src/tests/broken_conf_line_empty_string.phpt | 2 |
3 files changed, 10 insertions, 6 deletions
diff --git a/src/sp_config_utils.c b/src/sp_config_utils.c index b0c7d3c..f562ffd 100644 --- a/src/sp_config_utils.c +++ b/src/sp_config_utils.c | |||
| @@ -107,9 +107,13 @@ static char *get_string(size_t *consumed, char *restrict line, | |||
| 107 | ret[j++] = line[i]; | 107 | ret[j++] = line[i]; |
| 108 | } | 108 | } |
| 109 | err: | 109 | err: |
| 110 | sp_log_err("error", | 110 | if (0 == j) { |
| 111 | "There is an issue with the parsing of '%s': it doesn't look like a valid string on line %zu.", | 111 | sp_log_err("error", "A valid string as parameter is expected on line %zu.", sp_line_no); |
| 112 | original_line ? original_line : "NULL", sp_line_no); | 112 | } else { |
| 113 | sp_log_err("error", | ||
| 114 | "There is an issue with the parsing of '%s': it doesn't look like a valid string on line %zu.", | ||
| 115 | original_line ? original_line : "NULL", sp_line_no); | ||
| 116 | } | ||
| 113 | line = NULL; | 117 | line = NULL; |
| 114 | return NULL; | 118 | return NULL; |
| 115 | } | 119 | } |
diff --git a/src/tests/broken_conf_invalid_cidr_value.phpt b/src/tests/broken_conf_invalid_cidr_value.phpt index 876e9a0..a63df28 100644 --- a/src/tests/broken_conf_invalid_cidr_value.phpt +++ b/src/tests/broken_conf_invalid_cidr_value.phpt | |||
| @@ -7,5 +7,5 @@ Broken configuration, invalid cidr value | |||
| 7 | sp.configuration_file={PWD}/config/broken_conf_invalid_cidr_value.ini | 7 | sp.configuration_file={PWD}/config/broken_conf_invalid_cidr_value.ini |
| 8 | --FILE-- | 8 | --FILE-- |
| 9 | --EXPECT-- | 9 | --EXPECT-- |
| 10 | [snuffleupagus][0.0.0.0][error][error] There is an issue with the parsing of '"': it doesn't look like a valid string on line 1. | 10 | [snuffleupagus][0.0.0.0][error][error] A valid string as parameter is expected on line 1. |
| 11 | [snuffleupagus][0.0.0.0][config][error] " doesn't contain a valid cidr on line 1. | 11 | [snuffleupagus][0.0.0.0][config][error] " doesn't contain a valid cidr on line 1. \ No newline at end of file |
diff --git a/src/tests/broken_conf_line_empty_string.phpt b/src/tests/broken_conf_line_empty_string.phpt index ba8f9ca..44f8d5e 100644 --- a/src/tests/broken_conf_line_empty_string.phpt +++ b/src/tests/broken_conf_line_empty_string.phpt | |||
| @@ -6,4 +6,4 @@ Configuration line with an empty string | |||
| 6 | sp.configuration_file={PWD}/config/broken_conf_line_empty_string.ini | 6 | sp.configuration_file={PWD}/config/broken_conf_line_empty_string.ini |
| 7 | --FILE-- | 7 | --FILE-- |
| 8 | --EXPECT-- | 8 | --EXPECT-- |
| 9 | [snuffleupagus][0.0.0.0][error][error] There is an issue with the parsing of '': it doesn't look like a valid string on line 1. | 9 | [snuffleupagus][0.0.0.0][error][error] A valid string as parameter is expected on line 1. |
