Skip to content
Snippets Groups Projects
Verified Commit 086eef2e authored by Petr Špaček's avatar Petr Špaček
Browse files

prefill: avoid rename syscall

An attempt to rename/move temporary file to its final destination will
fail if /tmp and working directory belong to different filesystems.

It seems that temporary file is not required so it easier to get rid of
it altogether.
parent 57ec7f2b
Branches
Tags
1 merge request!511root zone import implementation
......@@ -42,15 +42,12 @@ end
-- Write root zone to a file.
local function rzone_write(rzone)
local tmp_rz_fname = os.tmpname()
local file = assert(io.open(tmp_rz_fname, 'w'))
local file = assert(io.open(rz_local_fname, 'w'))
for i = 1, #rzone do
local rzone_chunk = rzone[i]
file:write(rzone_chunk)
end
file:close()
os.rename(tmp_rz_fname, rz_local_fname)
-- TODO: IO error handling
end
local function display_delay(time)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment