]> git.e2factory.org Git - e2factory.git/commitdiff
check whether open(/dev/null) succeeded
authorTobias Ulmer <tu@emlix.com>
Wed, 7 Oct 2015 18:44:44 +0000 (20:44 +0200)
committerTobias Ulmer <tu@emlix.com>
Fri, 9 Oct 2015 17:21:35 +0000 (19:21 +0200)
Signed-off-by: Tobias Ulmer <tu@emlix.com>
generic/e2lib.lua

index 8b05dd08d5ee6c0541c8bbe4be254a000ccd04b1..fb340a97335ad01e2191b7fa4bf1f75c416682b0 100644 (file)
@@ -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