Equipped all non-system-dependent open(2) calls with O_BINARY
This commit is contained in:
parent
28b6533856
commit
a47b59791e
@ -5,7 +5,7 @@
|
||||
To compare tree /media/dvd and /original/dir :
|
||||
find /media/dvd -exec compare_file '{}' /media/dvd /original/dir ';'
|
||||
|
||||
Copyright 2008 - 2010 Thomas Schmitt, <scdbackup@gmx.net>
|
||||
Copyright 2008 - 2014 Thomas Schmitt, <scdbackup@gmx.net>
|
||||
|
||||
Provided under GPL version 2 or later.
|
||||
|
||||
@ -28,6 +28,10 @@
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
/* O_BINARY is needed for Cygwin but undefined elsewhere */
|
||||
#ifndef O_BINARY
|
||||
#define O_BINARY 0
|
||||
#endif
|
||||
|
||||
/* @param flag bit0= single letters */
|
||||
char *Ftypetxt(mode_t st_mode, int flag)
|
||||
@ -180,12 +184,12 @@ int Compare_2_files(char *adr1, char *adr2, char *adrc, int flag)
|
||||
}
|
||||
}
|
||||
if(S_ISREG(s1.st_mode) && S_ISREG(s2.st_mode)) {
|
||||
fd1= open(adr1, O_RDONLY);
|
||||
fd1= open(adr1, O_RDONLY | O_BINARY);
|
||||
if(fd1==-1) {
|
||||
printf("- %s : cannot open() : %s\n", adr1, strerror(errno));
|
||||
return(0);
|
||||
}
|
||||
fd2= open(adr2, O_RDONLY);
|
||||
fd2= open(adr2, O_RDONLY | O_BINARY);
|
||||
if(fd2==-1) {
|
||||
printf("- %s : cannot open() : %s\n", adr2, strerror(errno));
|
||||
close(fd1);
|
||||
|
@ -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 ");
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images.
|
||||
|
||||
Copyright 2007-2011 Thomas Schmitt, <scdbackup@gmx.net>
|
||||
Copyright 2007-2014 Thomas Schmitt, <scdbackup@gmx.net>
|
||||
|
||||
Provided under GPL version 2 or later.
|
||||
|
||||
@ -27,6 +27,10 @@
|
||||
#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"
|
||||
@ -64,7 +68,7 @@ int Xorriso_compare_2_contents(struct XorrisO *xorriso, char *common_adr,
|
||||
|
||||
respt= xorriso->result_line;
|
||||
|
||||
fd1= open(disk_adr, O_RDONLY);
|
||||
fd1= open(disk_adr, O_RDONLY | O_BINARY);
|
||||
if(fd1==-1) {
|
||||
sprintf(respt, "- %s (DISK) : cannot open() : %s\n",
|
||||
disk_adr, strerror(errno));
|
||||
|
@ -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);
|
||||
|
@ -28,6 +28,11 @@
|
||||
#include <fcntl.h>
|
||||
#include <utime.h>
|
||||
|
||||
/* O_BINARY is needed for Cygwin but undefined elsewhere */
|
||||
#ifndef O_BINARY
|
||||
#define O_BINARY 0
|
||||
#endif
|
||||
|
||||
|
||||
#include "lib_mgt.h"
|
||||
#include "drive_mgt.h"
|
||||
@ -561,7 +566,7 @@ int Xorriso_tree_restore_node(struct XorrisO *xorriso, IsoNode *node,
|
||||
open_flags= O_WRONLY|O_CREAT;
|
||||
if(disk_offset==0 || !(flag&2))
|
||||
open_flags|= O_EXCL;
|
||||
write_fd= open(open_path_pt, open_flags, S_IRUSR|S_IWUSR);
|
||||
write_fd= open(open_path_pt, open_flags | O_BINARY, S_IRUSR | S_IWUSR);
|
||||
l_errno= errno;
|
||||
if(write_fd == -1 && errno == EACCES && (flag & 128))
|
||||
{ret= 4; goto ex;}
|
||||
|
@ -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]);
|
||||
|
@ -34,6 +34,12 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* O_BINARY is needed for Cygwin but undefined elsewhere */
|
||||
#ifndef O_BINARY
|
||||
#define O_BINARY 0
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef Xorriso_standalonE
|
||||
|
||||
#ifdef Xorriso_with_libjtE
|
||||
@ -2025,7 +2031,7 @@ int Xorriso_burn_track(struct XorrisO *xorriso, off_t write_start_address,
|
||||
if(xorriso->fs >= 64)
|
||||
fd= burn_os_open_track_src(track_source, O_RDONLY, 0);
|
||||
else
|
||||
fd= open(track_source, O_RDONLY);
|
||||
fd= open(track_source, O_RDONLY | O_BINARY);
|
||||
if(fd>=0)
|
||||
if(fstat(fd,&stbuf)!=-1)
|
||||
if((stbuf.st_mode&S_IFMT)==S_IFREG)
|
||||
|
@ -1 +1 @@
|
||||
#define Xorriso_timestamP "2014.11.26.134709"
|
||||
#define Xorriso_timestamP "2014.11.26.164605"
|
||||
|
Loading…
Reference in New Issue
Block a user