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

This commit is contained in:
2014-11-26 14:44:43 +01:00
parent cdc336a02b
commit 3e33fa5fa1
3 changed files with 18 additions and 3 deletions

View File

@ -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);