We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8418a33 commit ea09cfdCopy full SHA for ea09cfd
shell.c
@@ -105,13 +105,6 @@ int cmd_cd(struct tokens *tokens){
105
}
106
107
/* Execute program */
108
-/*
109
- So what have I found?
110
- FIXME: program corrupts it own files
111
- FIXME: '>' creates executable files
112
- FIXME: core fault
113
- FIXME: '<' after using stops work of the shell
114
-*/
115
int shell_exec(struct tokens *tokens){
116
int saved_stdout = dup(fileno(stdout));
117
int saved_stdin = dup(fileno(stdin));
@@ -137,6 +130,7 @@ int shell_exec(struct tokens *tokens){
137
130
exit(1);
138
131
139
132
133
+ /* restore stdout and stdin to console input and output */
140
134
dup2(saved_stdin, fileno(stdin));
141
135
dup2(saved_stdout, fileno(stdout));
142
136
fflush(stdout);
0 commit comments