From: Dave Murphy Date: Sun, 6 Jan 2013 15:34:54 +0000 (+0000) Subject: file needs to be Binary for windows X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=f22b91b57a9dea96113946b810394e9fd1a524e5;p=fw%2Fstlink file needs to be Binary for windows O_BINARY only defined on windows --- diff --git a/src/stlink-common.c b/src/stlink-common.c index 82d6070..2d7db14 100644 --- a/src/stlink-common.c +++ b/src/stlink-common.c @@ -14,6 +14,10 @@ #include "stlink-common.h" #include "uglylogging.h" +#ifndef _WIN32 +#define O_BINARY 0 +#endif + #define LOG_TAG __FILE__ #define DLOG(format, args...) ugly_log(UDEBUG, LOG_TAG, format, ## args) #define ILOG(format, args...) ugly_log(UINFO, LOG_TAG, format, ## args) @@ -757,7 +761,7 @@ static int map_file(mapped_file_t* mf, const char* path) { int error = -1; struct stat st; - const int fd = open(path, O_RDONLY); + const int fd = open(path, O_RDONLY | O_BINARY); if (fd == -1) { fprintf(stderr, "open(%s) == -1\n", path); return -1;