diff --git a/fn/dns.php b/fn/dns.php
index 15a4c4a..6476942 100644
--- a/fn/dns.php
+++ b/fn/dns.php
@@ -8,12 +8,16 @@ function knotcExec($suffix, $cmd) {
serverError("knotc
failed with exit code " . $code['begin'] . ": " . $output['begin'][0] . ".");
exec(CONF['dns']['knotc_path'] . " zone-" . $action . "set " . $suffix . " " . implode(" ", $cmd), $output['op'], $code['op']);
- if ($code['op'] !== 0)
+ if ($code['op'] !== 0) {
+ exec(CONF['dns']['knotc_path'] . " zone-abort " . $suffix);
serverError("knotc
failed with exit code " . $code['op'] . ": " . $output['op'][0] . ".");
+ }
exec(CONF['dns']['knotc_path'] . " zone-commit " . $suffix, $output['commit'], $code['commit']);
- if ($code['commit'] !== 0)
+ if ($code['commit'] !== 0) {
+ exec(CONF['dns']['knotc_path'] . " zone-abort " . $suffix);
serverError("knotc
failed with exit code " . $code['commit'] . ": " . $output['commit'][0] . ".");
+ }
}
function checkIpFormat($ip) {