correction code
This commit is contained in:
@@ -65,17 +65,21 @@ int exec_cmd(char** args){
|
||||
int wstatus;
|
||||
pid_t pid = fork();
|
||||
|
||||
if (pid < 0) exit(-1);
|
||||
if (pid < 0){
|
||||
free(args);
|
||||
exit(-1);
|
||||
}
|
||||
// Child
|
||||
else if (pid == 0){
|
||||
|
||||
if(strcmp(args[0] , "run") != 0) exit(-1);
|
||||
|
||||
if(execvp(args[1], args + 1) != 0) exit(-1);
|
||||
exit(0);
|
||||
|
||||
//if(execvp(args[0], args) == -1) exit(-1);
|
||||
//if(strcmp(args[0] , "run") != 0) exit(-1);
|
||||
|
||||
//on execute la commande et on return son code de fin
|
||||
exit(execvp(args[1], args + 1));
|
||||
|
||||
//if(execvp(args[1], args + 1) != 0) exit(-1);
|
||||
//exit(0);
|
||||
|
||||
}
|
||||
|
||||
//Uncle... You're again ! Oh it's not my uncle it's my daddy !
|
||||
|
||||
Reference in New Issue
Block a user