From: Tobias Ulmer Date: Tue, 17 Nov 2015 16:50:34 +0000 (+0100) Subject: policy: use eio X-Git-Tag: e2factory-2.3.15rc1~173 X-Git-Url: https://git.e2factory.org/?a=commitdiff_plain;h=7f3f06bec6b283485c656de5e26c262e0a27380d;p=e2factory.git policy: use eio Signed-off-by: Tobias Ulmer --- diff --git a/local/policy.lua b/local/policy.lua index 762721a..cdab23e 100644 --- a/local/policy.lua +++ b/local/policy.lua @@ -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)