From b94e827f906d4c725ab73a18c02300d32bdfc6a9 Mon Sep 17 00:00:00 2001 Message-Id: From: Mark Wooding Date: Sun, 17 Nov 2013 11:01:05 +0000 Subject: [PATCH] More error string formatting. Organization: Straylight/Edgeware From: Richard Kettlewell --- lib/configuration.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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) { -- [mdw]