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-2012 Thomas Schmitt, <scdbackup@gmx.net>
Copyright 2007-2014 Thomas Schmitt, <scdbackup@gmx.net>
Provided under GPL version 2 or later.
@ -27,6 +27,11 @@
#include <pwd.h>
#include <grp.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"
@ -2099,7 +2104,7 @@ int Xorriso_concat(struct XorrisO *xorriso, char *mode, char *target,
open_mode |= O_TRUNC;
}
if(fd == -1) {
fd= open(target, O_WRONLY | O_TRUNC | O_CREAT, 0666);
fd= open(target, O_WRONLY | O_TRUNC | O_CREAT | O_BINARY, 0666);
fd_opened= 1;
}
} else if(strcmp(mode, "append") == 0) {
@ -2108,7 +2113,7 @@ int Xorriso_concat(struct XorrisO *xorriso, char *mode, char *target,
goto ex;
target_is_regular= (ret == 2);
if(fd == -1) {
fd= open(target, O_WRONLY | O_CREAT, 0666);
fd= open(target, O_WRONLY | O_CREAT | O_BINARY, 0666);
fd_opened= 1;
if(fd != -1 && target_is_regular) {
ret= lseek(fd, (off_t) 0, SEEK_END);