summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjvoisin2017-10-18 00:31:18 +0200
committerjvoisin2017-10-18 15:27:21 +0200
commit765b7f81a1d157e809889c7224581db70a0ebe53 (patch)
tree7bdfb1279d6c736a4287dfeddfe96171afe365df /src
parent1e73d00ffaf4cadcaadcd7fae3b3be99305fb439 (diff)
Improve the strtol dance
Diffstat (limited to 'src')
-rw-r--r--src/sp_config_keywords.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/sp_config_keywords.c b/src/sp_config_keywords.c
index cbdd579..b03c28e 100644
--- a/src/sp_config_keywords.c
+++ b/src/sp_config_keywords.c
@@ -239,13 +239,17 @@ int parse_disabled_functions(char *line) {
239 if (pos) { 239 if (pos) {
240 errno = 0; 240 errno = 0;
241 char *endptr; 241 char *endptr;
242 df->pos = strtol(pos, &endptr, 10) > 128 ? 128 : strtol(pos, NULL, 10); 242 df->pos = strtol(pos, &endptr, 10);
243 if (errno != 0 || endptr == pos) { 243 if (errno != 0 || endptr == pos) {
244 sp_log_err("config", 244 sp_log_err("config", "Failed to parse arg '%s' of `pos` on line %zu.",
245 "Failed to parse arg '%s' of `pos` on line %zu.", 245 pos, sp_line_no);
246 pos, sp_line_no);
247 return -1; 246 return -1;
248 } 247 }
248
249 // We'll never have a function with more than 128 params
250 if (df->pos > 128) {
251 df->pos = 128;
252 }
249 } 253 }
250 254
251 if (df->function) { 255 if (df->function) {