Browse Source

[Pal/Linux-SGX] Simplify sgx_create_process() control flow

Isaku Yamahata 6 years ago
parent
commit
016b238b41
1 changed files with 8 additions and 15 deletions
  1. 8 15
      Pal/src/host/Linux-SGX/sgx_process.c

+ 8 - 15
Pal/src/host/Linux-SGX/sgx_process.c

@@ -87,25 +87,18 @@ int sgx_create_process (const char * uri, int nargs, const char ** args,
         for (int i = 0 ; i < 3 ; i++)
             INLINE_SYSCALL(close, 1, proc_fds[1][i]);
 
-        rete = INLINE_SYSCALL(dup2, 2, proc_fds[0][0], PROC_INIT_FD);
-        if (IS_ERR(rete))
-            goto out_child;
-
-        extern char** environ;
-        rete = INLINE_SYSCALL(execve, 3, PAL_LOADER, argv, environ);
-
-        /* shouldn't get to here */
-        SGX_DBG(DBG_E, "unexpected failure of new process\n");
-out_child:
+        ret = INLINE_SYSCALL(dup2, 2, proc_fds[0][0], PROC_INIT_FD);
+        if (!IS_ERR(ret)) {
+            extern char** environ;
+            ret = INLINE_SYSCALL(execve, 3, PAL_LOADER, argv, environ);
+
+            /* shouldn't get to here */
+            SGX_DBG(DBG_E, "unexpected failure of new process\n");
+        }
         __asm__ volatile ("hlt");
         return 0;
     }
 
-    if (IS_ERR(rete)) {
-        ret = -EPERM;
-        goto out;
-    }
-
     child = ret;
 
     for (int i = 0 ; i < 3 ; i++)