瀏覽代碼

Splitting guard from error check

Renato Golin 13 年之前
父節點
當前提交
9a4d4f107c
共有 1 個文件被更改,包括 5 次插入3 次删除
  1. 5 3
      system/jlib/jthread.cpp

+ 5 - 3
system/jlib/jthread.cpp

@@ -1784,9 +1784,11 @@ public:
 
             unsigned argc;
             char **argv=splitargs(prog,argc);
-            if (dir.get() && chdir(dir) == -1) {
-                ERRLOG("CLinuxPipeProcess::run: could not change dir to %s", dir.get());
-                throwUnexpected();
+            if (dir.get()) {
+                if (chdir(dir) == -1) {
+                    ERRLOG("CLinuxPipeProcess::run: could not change dir to %s", dir.get());
+                    throwUnexpected();
+                }
             }
             execvp(argv[0],argv);
             _exit(START_FAILURE);    // must be _exit!!