Equipped all non-system-dependent open(2) calls with O_BINARY.
This commit is contained in:
parent
cdc336a02b
commit
3e33fa5fa1
@ -21,6 +21,11 @@
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/* O_BINARY is needed for Cygwin but undefined elsewhere */
|
||||
#ifndef O_BINARY
|
||||
#define O_BINARY 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Private data for File IsoDataSource
|
||||
*/
|
||||
@ -65,7 +70,7 @@ int ds_open(IsoDataSource *src)
|
||||
return ISO_FILE_ALREADY_OPENED;
|
||||
}
|
||||
|
||||
fd = open(data->path, O_RDONLY);
|
||||
fd = open(data->path, O_RDONLY | O_BINARY);
|
||||
if (fd == -1) {
|
||||
return ISO_FILE_ERROR;
|
||||
}
|
||||
|
@ -30,6 +30,11 @@
|
||||
#include <libgen.h>
|
||||
#include <string.h>
|
||||
|
||||
/* O_BINARY is needed for Cygwin but undefined elsewhere */
|
||||
#ifndef O_BINARY
|
||||
#define O_BINARY 0
|
||||
#endif
|
||||
|
||||
static
|
||||
int iso_file_source_new_lfs(IsoFileSource *parent, const char *name,
|
||||
IsoFileSource **src);
|
||||
@ -222,7 +227,7 @@ int lfs_open(IsoFileSource *src)
|
||||
data->info.dir = opendir(path);
|
||||
data->openned = data->info.dir ? 2 : 0;
|
||||
} else {
|
||||
data->info.fd = open(path, O_RDONLY);
|
||||
data->info.fd = open(path, O_RDONLY | O_BINARY);
|
||||
data->openned = data->info.fd != -1 ? 1 : 0;
|
||||
}
|
||||
free(path);
|
||||
|
@ -42,6 +42,11 @@
|
||||
#include <uuid/uuid.h>
|
||||
#endif
|
||||
|
||||
/* O_BINARY is needed for Cygwin but undefined elsewhere */
|
||||
#ifndef O_BINARY
|
||||
#define O_BINARY 0
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Create a MBR for an isohybrid enabled ISOLINUX boot image.
|
||||
@ -2079,7 +2084,7 @@ void iso_random_uuid(Ecma119Image *t, uint8_t uuid[16])
|
||||
(Weakening the result by 8 bit saves a lot of pool entropy.)
|
||||
*/
|
||||
if ((counter & 0xff) == 0) {
|
||||
fd = open("/dev/urandom", O_RDONLY);
|
||||
fd = open("/dev/urandom", O_RDONLY | O_BINARY);
|
||||
if (fd == -1)
|
||||
goto fallback;
|
||||
ret = read(fd, uuid_urandom, 16);
|
||||
|
Loading…
Reference in New Issue
Block a user