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
     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()
     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