]> git.e2factory.org Git - e2factory.git/commitdiff
policy: use eio
authorTobias Ulmer <tu@emlix.com>
Tue, 17 Nov 2015 16:50:34 +0000 (17:50 +0100)
committerTobias Ulmer <tu@emlix.com>
Wed, 16 Nov 2016 14:41:18 +0000 (15:41 +0100)
Signed-off-by: Tobias Ulmer <tu@emlix.com>
local/policy.lua

index 762721a91bece32884dcfdce06e66cae1a3d7f12..cdab23e127ee3d3da777ca3dcbdae3777950c73e 100644 (file)
@@ -32,9 +32,10 @@ local policy = {}
 local cache = require("cache")
 local e2lib = require("e2lib")
 local e2option = require("e2option")
+local eio = require("eio")
 local err = require("err")
-local strict = require("strict")
 local hash = require("hash")
+local strict = require("strict")
 
 --- Get the source set identifier.
 -- @return string: the source set identifier
@@ -141,20 +142,20 @@ local function buildid_scratch(buildid)
         return buildid_scratch_cache[buildid]
     end
 
-    local rfile, msg, rstr
+    local rfile, re, rstr
     local hc, newbuildid
 
-    rfile, msg = io.open("/dev/urandom")
+    rfile, re = eio.fopen("/dev/urandom", "r")
     if not rfile then
-        e2lib.abort(msg)
+        e2lib.abort(re)
     end
 
-    rstr = rfile:read(16)
+    rstr, re = eio.fread(rfile, 16)
     if not rstr or string.len(rstr) ~= 16 then
-        e2lib.abort("could not get 16 bytes of entrophy")
+        e2lib.abort("could not get 16 bytes of entropy")
     end
 
-    rfile:close()
+    eio.fclose(rfile)
 
     hc = hash.hash_start()
     hash.hash_append(hc, buildid)