Skip to content

Commit

Permalink
add read perm for pipe file [#102]
Browse files Browse the repository at this point in the history
  • Loading branch information
stsp committed Aug 30, 2024
1 parent 85fdda8 commit cbba168
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/command.c
Original file line number Diff line number Diff line change
Expand Up @@ -4320,9 +4320,9 @@ static void exec_cmd(int call)
pipe_fno[STDIN_INDEX] = open(pipe_file[STDIN_INDEX], O_TEXT|O_RDONLY, S_IRUSR);

if (pipe_file_redir_count[STDOUT_INDEX] > 1)
pipe_fno[STDOUT_INDEX] = open(pipe_file[STDOUT_INDEX], O_BINARY|O_WRONLY|O_APPEND|O_CREAT, S_IWUSR); // open for append
pipe_fno[STDOUT_INDEX] = open(pipe_file[STDOUT_INDEX], O_BINARY|O_WRONLY|O_APPEND|O_CREAT, S_IRUSR | S_IWUSR); // open for append
else if (pipe_file_redir_count[STDOUT_INDEX] == 1)
pipe_fno[STDOUT_INDEX] = open(pipe_file[STDOUT_INDEX], O_BINARY|O_WRONLY|O_TRUNC|O_CREAT, S_IWUSR); // open as new file
pipe_fno[STDOUT_INDEX] = open(pipe_file[STDOUT_INDEX], O_BINARY|O_WRONLY|O_TRUNC|O_CREAT, S_IRUSR | S_IWUSR); // open as new file

/* check for error
if (pipe_fno[pipe_index] < 0 ||
Expand Down

0 comments on commit cbba168

Please sign in to comment.