From: Petr Špaček Date: Mon, 16 Apr 2018 11:59:56 +0000 (+0200) Subject: prefill: avoid rename syscall X-Git-Tag: v2.3.0~6^2~6 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=086eef2e00f979849bed21858edb2cc706cb81d6;p=thirdparty%2Fknot-resolver.git 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. --- 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)