Explorar el Código

amended check_redirect

master
10195501441 hace 3 años
padre
commit
021321f093
Se han modificado 3 ficheros con 2 adiciones y 2 borrados
  1. +0
    -0
      result.txt
  2. BIN
      yeeshell
  3. +2
    -2
      yeeshell.c

+ 0
- 0
result.txt Ver fichero


BIN
yeeshell Ver fichero


+ 2
- 2
yeeshell.c Ver fichero

@ -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,

Cargando…
Cancelar
Guardar