X-Git-Url: https://git.hcoop.net/hcoop/domtool2.git/blobdiff_plain/3f07a40e5a17c2bce4d90e1a154f8a73d476aaaa..77a8fca278b561808959fa1aa7d9f02c5cfe7720:/src/plugins/bind.sml diff --git a/src/plugins/bind.sml b/src/plugins/bind.sml index 9a05dce..9c72152 100644 --- a/src/plugins/bind.sml +++ b/src/plugins/bind.sml @@ -131,7 +131,7 @@ val monthToInt = fn Date.Jan => 1 fun padBy ch amt s = if size s < amt then - CharVector.tabulate (amt, fn _ => ch) ^ s + CharVector.tabulate (amt - size s, fn _ => ch) ^ s else s @@ -177,13 +177,15 @@ val () = Slave.registerFileHandler (fn fs => val min = readILine inf val () = TextIO.closeIn inf + val serialPath = OS.Path.joinDirFile {dir = Config.serialDir, + file = #domain fs} + val oldSerial = let - val inf = TextIO.openIn (OS.Path.joinDirFile {dir = #dir fs, - file = "serial"}) + val inf = TextIO.openIn serialPath in SOME (readLine inf) before TextIO.closeIn inf - end handle IO.Io _ => NONE + end handle IO.Io {name, ...} => NONE val newSerial = case serial of @@ -205,8 +207,7 @@ val () = Slave.registerFileHandler (fn fs => "00") end - val outf = TextIO.openOut (OS.Path.joinDirFile {dir = #dir fs, - file = "serial"}) + val outf = TextIO.openOut serialPath val _ = TextIO.output (outf, newSerial) val _ = TextIO.closeOut outf @@ -265,4 +266,8 @@ val () = Slave.registerPostHandler fn cl => "Error reloading bind with " ^ cl) else ())) + +val () = Domain.registerResetLocal (fn () => + ignore (OS.Process.system (Config.rm ^ " -rf /var/domtool/zones/*"))) + end