From: Richard Kettlewell Date: Sun, 17 Nov 2013 11:01:05 +0000 (+0000) Subject: More error string formatting. X-Git-Tag: 5.2~107 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/disorder/commitdiff_plain/b94e827f906d4c725ab73a18c02300d32bdfc6a9 More error string formatting. --- diff --git a/lib/configuration.c b/lib/configuration.c index 5d3f919..62ccf1b 100644 --- a/lib/configuration.c +++ b/lib/configuration.c @@ -752,6 +752,7 @@ static int validate_tracklength(const struct config_state *cs, static int validate_non_negative(const struct config_state *cs, int nvec, char **vec) { long n; + char errbuf[1024]; if(nvec < 1) { disorder_error(0, "%s:%d: missing argument", cs->path, cs->line); @@ -762,7 +763,8 @@ static int validate_non_negative(const struct config_state *cs, return -1; } if(xstrtol(&n, vec[0], 0, 0)) { - disorder_error(0, "%s:%d: %s", cs->path, cs->line, strerror(errno)); + disorder_error(0, "%s:%d: %s", cs->path, cs->line, + format_error(ec_errno, errno, errbuf, sizeof errbuf)); return -1; } if(n < 0) { @@ -781,6 +783,7 @@ static int validate_non_negative(const struct config_state *cs, static int validate_positive(const struct config_state *cs, int nvec, char **vec) { long n; + char errbuf[1024]; if(nvec < 1) { disorder_error(0, "%s:%d: missing argument", cs->path, cs->line); @@ -791,7 +794,8 @@ static int validate_positive(const struct config_state *cs, return -1; } if(xstrtol(&n, vec[0], 0, 0)) { - disorder_error(0, "%s:%d: %s", cs->path, cs->line, strerror(errno)); + disorder_error(0, "%s:%d: %s", cs->path, cs->line, + format_error(ec_errno, errno, errbuf, sizeof errbuf)); return -1; } if(n <= 0) {