|
@ -204,13 +204,13 @@ int execute(char *cmdline, char **args) |
|
|
{ |
|
|
{ |
|
|
fd = open(redirect_filename, O_CREAT | O_WRONLY | O_TRUNC, S_IRUSR | S_IWUSR | S_IXUSR); |
|
|
fd = open(redirect_filename, O_CREAT | O_WRONLY | O_TRUNC, S_IRUSR | S_IWUSR | S_IXUSR); |
|
|
close(1); |
|
|
close(1); |
|
|
dup2(1, fd); |
|
|
|
|
|
|
|
|
dup(fd); |
|
|
} |
|
|
} |
|
|
else if (redirect_flag == 2) |
|
|
else if (redirect_flag == 2) |
|
|
{ |
|
|
{ |
|
|
fd = open(redirect_filename, O_RDONLY, S_IRUSR); |
|
|
fd = open(redirect_filename, O_RDONLY, S_IRUSR); |
|
|
close(0); |
|
|
close(0); |
|
|
dup2(0, fd); |
|
|
|
|
|
|
|
|
dup(fd); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/* The child process inherits the parent's signal mask and will inherit it after exec,
|
|
|
/* The child process inherits the parent's signal mask and will inherit it after exec,
|
|
|