aboutsummaryrefslogtreecommitdiff
path: root/build/rule.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-02-24 08:54:03 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-02-24 08:54:03 +0200
commitcd9a4ea692ba87aa03a80489bf03736e713722c7 (patch)
treeb98abc4442dd3fa55cdb3c37f50da5a210a15126 /build/rule.cxx
parentfdb050b4b1b966683ff00dd14b268fe395492358 (diff)
Sort out diagnostics for mkdir
Diffstat (limited to 'build/rule.cxx')
-rw-r--r--build/rule.cxx21
1 files changed, 10 insertions, 11 deletions
diff --git a/build/rule.cxx b/build/rule.cxx
index e57feca..41296f0 100644
--- a/build/rule.cxx
+++ b/build/rule.cxx
@@ -4,15 +4,13 @@
#include <build/rule>
-#include <string.h> // strerror_r()
-#include <sys/stat.h> // mkdir()
-#include <sys/types.h> // mkdir()
-
-#include <utility> // move()
+#include <utility> // move()
+#include <system_error>
#include <build/algorithm>
#include <build/diagnostics>
#include <build/timestamp>
+#include <build/mkdir>
using namespace std;
@@ -169,13 +167,14 @@ namespace build
else
text << "mkdir " << t; //@@ Probably only show if [show]?
- if (mkdir (d.string ().c_str (), 0777) != 0)
+ try
+ {
+ mkdir (d);
+ }
+ catch (const system_error& e)
{
- char b[512];
- const char* m (strerror_r (errno, b, sizeof (b)) == 0
- ? b
- : "error message too long");
- fail << "mkdir: unable to create directory " << d.string () << ": " << m;
+ fail << "unable to create directory " << d.string () << ": "
+ << e.what ();
}
return target_state::updated;