summaryrefslogtreecommitdiff
path: root/dns.php
diff options
context:
space:
mode:
authorLuke Bratch <luke@bratch.co.uk>2017-09-20 19:50:55 +0100
committerLuke Bratch <luke@bratch.co.uk>2017-09-20 19:50:55 +0100
commit156bdf66d4f433d8289f03e1a0ba3e6d0cd04e06 (patch)
tree4587144ee4193efe53189609d4032de7b105f0c6 /dns.php
parentf56418929029b40b758e9ae8051afc9f4782cb60 (diff)
Handle a failure when writing the zone file
Diffstat (limited to 'dns.php')
-rw-r--r--dns.php9
1 files changed, 8 insertions, 1 deletions
diff --git a/dns.php b/dns.php
index 6e560d9..85844b3 100644
--- a/dns.php
+++ b/dns.php
@@ -119,7 +119,14 @@ function writezone($domain, $zonetext, $password = null) {
}
// Reload the zone if we got this far
- sshrun("echo -en \"$zonetext\" > " . ZONEROOT . "$domain" . ZONESUFFIX);
+ $zonewrite = sshrun("echo -en \"$zonetext\" > " . ZONEROOT . "$domain" . ZONESUFFIX . " && echo $? || echo $?");
+
+ // If the return code was non-zero then fail
+ if ($zonewrite[sizeof($zonewrite) - 1] != "0") {
+ echo "<p>error: something went wrong when writing the zone file, please ask someone for help</p>";
+ die();
+ }
+
sshrun("rndc reload $domain");
}