浏览代码

HPCC-22554 pipe->run would stall if it's thread failed to create handles.

Signed-off-by: Jake Smith <jake.smith@lexisnexisrisk.com>
Jake Smith 6 年之前
父节点
当前提交
89f9338233
共有 1 个文件被更改,包括 8 次插入9 次删除
  1. 8 9
      system/jlib/jthread.cpp

+ 8 - 9
system/jlib/jthread.cpp

@@ -1954,15 +1954,14 @@ public:
         int inpipe[2];
         int outpipe[2];
         int errpipe[2];
-        if (hasinput)
-            if (::pipe(inpipe)==-1)
-                throw makeOsException(errno);
-        if (hasoutput)
-            if (::pipe(outpipe)==-1)
-                throw makeOsException(errno);
-        if (haserror)
-            if (::pipe(errpipe)==-1)
-                throw makeOsException(errno);
+        if ((hasinput && (::pipe(inpipe)==-1)) ||
+            (hasoutput && (::pipe(outpipe)==-1)) ||
+            (haserror && (::pipe(errpipe)==-1)))
+        {
+            retcode = START_FAILURE;
+            started.signal();
+            throw makeOsException(errno);
+        }
 
         /* NB: Important to call splitargs (which calls malloc) before the fork()
          * and not in the child process. Because performing malloc in the child