From: Tobias Ulmer Date: Wed, 7 Oct 2015 18:44:44 +0000 (+0200) Subject: check whether open(/dev/null) succeeded X-Git-Tag: e2factory-2.3.14p1~6 X-Git-Url: https://git.e2factory.org/?a=commitdiff_plain;h=6d0264c350df7423e42c4af9c6ebbc96617ffa41;p=e2factory.git check whether open(/dev/null) succeeded Signed-off-by: Tobias Ulmer --- diff --git a/generic/e2lib.lua b/generic/e2lib.lua index 8b05dd0..fb340a9 100644 --- a/generic/e2lib.lua +++ b/generic/e2lib.lua @@ -931,6 +931,9 @@ end function e2lib.callcmd_redirect(cmd, out) local devnull, pid, rc devnull = luafile.open("/dev/null", "r") + if not devnull then + e2lib.abort("could not open /dev/null") + end e2lib.log(3, "+ " .. cmd) pid = e2util.fork() if pid == 0 then @@ -954,6 +957,11 @@ function e2lib.callcmd_pipe(cmds, infile, outfile) local rcs = {} local pids = {} local ers = {} + + if not i then + e2lib.abort("could not open /dev/null") + end + for n = 1, c do local o, pr, fr, er, ew pr, er, ew = luafile.pipe() @@ -1039,6 +1047,9 @@ function e2lib.callcmd_capture(cmd, capture) owrite:setlinebuf() oread:setlinebuf() devnull = luafile.open("/dev/null", "r") + if not devnull then + e2lib.abort("could not open /dev/null") + end e2lib.log(4, "+ " .. cmd) pid = e2util.fork() if pid == 0 then