Equipped all non-system-dependent open(2) calls with O_BINARY

This commit is contained in:
2014-11-26 16:47:40 +00:00
parent 28b6533856
commit a47b59791e
8 changed files with 54 additions and 20 deletions

View File

@ -26,6 +26,11 @@
#include <pthread.h>
#include <fcntl.h>
/* O_BINARY is needed for Cygwin but undefined elsewhere */
#ifndef O_BINARY
#define O_BINARY 0
#endif
/* for -charset */
#include <iconv.h>
@ -4168,7 +4173,7 @@ no_pipe_open:
xorriso->use_stdin= 1;
if(cmd_pipe_adr[0] && reply_pipe_adr[0]) {
command_pipe[0]= open(cmd_pipe_adr, O_RDONLY);
command_pipe[0]= open(cmd_pipe_adr, O_RDONLY | O_BINARY);
if(command_pipe[0] == -1) {
sprintf(xorriso->info_text,
"-launch_frontend: Failed to open named command pipe %s",
@ -4177,7 +4182,7 @@ no_pipe_open:
"FAILURE", 0);
ret= 0; goto ex;
}
reply_pipe[1]= open(reply_pipe_adr, O_WRONLY | O_APPEND);
reply_pipe[1]= open(reply_pipe_adr, O_WRONLY | O_APPEND | O_BINARY);
if(reply_pipe[1] == -1) {
sprintf(xorriso->info_text,
"-launch_frontend: Failed to open named reply pipe %s",
@ -4215,7 +4220,7 @@ no_dup:;
/* Close unused pipe ends */;
if(cmd_pipe_adr[0] && reply_pipe_adr[0]) {
command_pipe[1]= open(cmd_pipe_adr, O_WRONLY | O_APPEND);
command_pipe[1]= open(cmd_pipe_adr, O_WRONLY | O_APPEND | O_BINARY);
if(command_pipe[1] == -1) {
fprintf(stderr,
"xorriso: -launch_frontend: Failed to open named command pipe '%s'\n",
@ -4223,7 +4228,7 @@ no_dup:;
perror("xorriso: -launch_frontend");
exit(1);
}
reply_pipe[0]= open(reply_pipe_adr, O_RDONLY);
reply_pipe[0]= open(reply_pipe_adr, O_RDONLY | O_BINARY);
if(reply_pipe[0] == -1) {
fprintf(stderr,
"xorriso: -launch_frontend: Failed to open named reply pipe '%s'\n",
@ -4267,7 +4272,7 @@ int Xorriso_open_named_pipe(struct XorrisO *xorriso, char fd_names[3][20],
{
if(mem_fds[i] == -1)
return(2);
pipe_fds[i]= open(pipe_paths[i], i == 0 ? O_RDONLY : O_WRONLY);
pipe_fds[i]= open(pipe_paths[i], (i == 0 ? O_RDONLY : O_WRONLY) | O_BINARY);
if(pipe_fds[i] == -1) {
sprintf(xorriso->info_text,
"-named_pipe_loop: Failed to open %s pipe ", fd_names[i]);