Skip to content

Commit b85da89

Browse files
committed
open pipe files in binary mode
This avoids double \r when copying the file that already has \r\n.
1 parent 2147a36 commit b85da89

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/command.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -4237,9 +4237,9 @@ static void exec_cmd(int call)
42374237
pipe_fno[STDIN_INDEX] = open(pipe_file[STDIN_INDEX], O_TEXT|O_RDONLY, S_IRUSR);
42384238

42394239
if (pipe_file_redir_count[STDOUT_INDEX] > 1)
4240-
pipe_fno[STDOUT_INDEX] = open(pipe_file[STDOUT_INDEX], O_TEXT|O_WRONLY|O_APPEND|O_CREAT, S_IWUSR); // open for append
4240+
pipe_fno[STDOUT_INDEX] = open(pipe_file[STDOUT_INDEX], O_BINARY|O_WRONLY|O_APPEND|O_CREAT, S_IWUSR); // open for append
42414241
else if (pipe_file_redir_count[STDOUT_INDEX] == 1)
4242-
pipe_fno[STDOUT_INDEX] = open(pipe_file[STDOUT_INDEX], O_TEXT|O_WRONLY|O_TRUNC|O_CREAT, S_IWUSR); // open as new file
4242+
pipe_fno[STDOUT_INDEX] = open(pipe_file[STDOUT_INDEX], O_BINARY|O_WRONLY|O_TRUNC|O_CREAT, S_IWUSR); // open as new file
42434243

42444244
/* check for error
42454245
if (pipe_fno[pipe_index] < 0 ||

0 commit comments

Comments
 (0)