Usermode/CLIShell - Fixed not catching execve returning
authorJohn Hodge <[email protected]>
Sun, 20 Nov 2011 07:20:40 +0000 (15:20 +0800)
committerJohn Hodge <[email protected]>
Sun, 20 Nov 2011 07:20:40 +0000 (15:20 +0800)
Usermode/Applications/CLIShell_src/main.c

index 58432da..89bfe0d 100644 (file)
@@ -49,7 +49,7 @@ char  **gasCommandHistory;
  int   giCommandSpace = 0;\r
 \r
 // ==== CODE ====\r
-int main(int argc, char *argv[], char *envp[])\r
+int main(int argc, char *argv[], char **envp)\r
 {\r
        char    *sCommandStr;\r
        char    *saArgs[32] = {0};\r
@@ -391,8 +391,11 @@ void CallCommand(char **Args)
        // Create new process\r
        pid = clone(CLONE_VM, 0);\r
        // Start Task\r
-       if(pid == 0)\r
+       if(pid == 0) {\r
                execve(sTmpBuffer, Args, gasEnvironment);\r
+               printf("Execve returned, ... oops\n");\r
+               exit(-1);\r
+       }\r
        if(pid <= 0) {\r
                printf("Unable to create process: `%s'\n", sTmpBuffer); // Error Message\r
        }\r

UCC git Repository :: git.ucc.asn.au