chiark / gitweb /
More error string formatting.
authorRichard Kettlewell <rjk@greenend.org.uk>
Sun, 17 Nov 2013 11:01:05 +0000 (11:01 +0000)
committerRichard Kettlewell <rjk@greenend.org.uk>
Sun, 17 Nov 2013 11:01:05 +0000 (11:01 +0000)
lib/configuration.c

index 5d3f919c24c672049322d8f5da4b42799afdf464..62ccf1b5df614aff6f0776a0350cd14bc020e40a 100644 (file)
@@ -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) {