瀏覽代碼

amended check_redirect

master
10195501441 3 年之前
父節點
當前提交
021321f093
共有 3 個檔案被更改,包括 2 行新增2 行删除
  1. +0
    -0
      result.txt
  2. 二進制
      yeeshell
  3. +2
    -2
      yeeshell.c

+ 0
- 0
result.txt 查看文件


二進制
yeeshell 查看文件


+ 2
- 2
yeeshell.c 查看文件

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

Loading…
取消
儲存