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 33fee4725c
commit 2c838f7175
8 changed files with 54 additions and 20 deletions

View File

@ -1,7 +1,7 @@
/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images.
Copyright 2007-2013 Thomas Schmitt, <scdbackup@gmx.net>
Copyright 2007-2014 Thomas Schmitt, <scdbackup@gmx.net>
Provided under GPL version 2 or later.
@ -25,6 +25,11 @@
#include <fcntl.h>
#include <errno.h>
/* O_BINARY is needed for Cygwin but undefined elsewhere */
#ifndef O_BINARY
#define O_BINARY 0
#endif
#include "xorriso.h"
#include "xorriso_private.h"
#include "xorrisoburn.h"
@ -293,7 +298,7 @@ int Sectorbitmap_from_file(struct SectorbitmaP **o, char *path, char *msg,
*os_errno= 0;
if(msg != NULL)
msg[0]= 0;
fd= open(path, O_RDONLY);
fd= open(path, O_RDONLY | O_BINARY);
if(fd == -1) {
*os_errno= errno;
if(msg != NULL) {
@ -373,7 +378,7 @@ int Sectorbitmap_to_file(struct SectorbitmaP *o, char *path, char *info,
unsigned char buf[40];
*os_errno= 0;
fd= open(path, O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR);
fd= open(path, O_WRONLY | O_CREAT | O_BINARY, S_IRUSR | S_IWUSR);
if(fd == -1) {
*os_errno= errno;
if(msg != NULL) {
@ -1074,7 +1079,7 @@ int Xorriso_open_job_data_to(struct XorrisO *xorriso,
{
if(job->data_to_path[0] == 0)
return(2);
job->data_to_fd= open(job->data_to_path, O_RDWR | O_CREAT,
job->data_to_fd= open(job->data_to_path, O_RDWR | O_CREAT | O_BINARY,
S_IRUSR | S_IWUSR);
if(job->data_to_fd == -1) {
sprintf(xorriso->info_text, "Cannot open path ");