Sfoglia il codice sorgente

amended check_redirect

master
10195501441 3 anni fa
parent
commit
021321f093
3 ha cambiato i file con 2 aggiunte e 2 eliminazioni
  1. +0
    -0
      result.txt
  2. BIN
      yeeshell
  3. +2
    -2
      yeeshell.c

+ 0
- 0
result.txt Vedi File


BIN
yeeshell Vedi File


+ 2
- 2
yeeshell.c Vedi File

@ -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);
close(1);
dup2(1, fd);
dup(fd);
}
else if (redirect_flag == 2)
{
fd = open(redirect_filename, O_RDONLY, S_IRUSR);
close(0);
dup2(0, fd);
dup(fd);
}
/* The child process inherits the parent's signal mask and will inherit it after exec,

Caricamento…
Annulla
Salva