From 086eef2e00f979849bed21858edb2cc706cb81d6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20=C5=A0pa=C4=8Dek?= <petr.spacek@nic.cz>
Date: Mon, 16 Apr 2018 13:59:56 +0200
Subject: [PATCH] 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.
---
 modules/prefill/prefill.lua | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/modules/prefill/prefill.lua b/modules/prefill/prefill.lua
index 19d89ecc5..f74d711b0 100644
--- a/modules/prefill/prefill.lua
+++ b/modules/prefill/prefill.lua
@@ -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)
-- 
GitLab