From 916077012ed4810492d6e45ed07222cdbb750fc0 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Fri, 16 Mar 2018 11:27:11 -0700 Subject: [PATCH] Make sure fopen is in binary mode on Windows. --- service/OneService.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/service/OneService.cpp b/service/OneService.cpp index 4854d68d8..abbd6e757 100644 --- a/service/OneService.cpp +++ b/service/OneService.cpp @@ -2118,7 +2118,7 @@ public: // Check to see if we've already written this first. This reduces // redundant writes and I/O overhead on most platforms and has // little effect on others. - f = fopen(p,"r"); + f = fopen(p,"rb"); if (f) { char buf[65535]; long l = (long)fread(buf,1,sizeof(buf),f); @@ -2127,10 +2127,10 @@ public: return; } - f = fopen(p,"w"); + f = fopen(p,"wb"); if ((!f)&&(dirname[0])) { // create subdirectory if it does not exist OSUtils::mkdir(dirname); - f = fopen(p,"w"); + f = fopen(p,"wb"); } if (f) { if (fwrite(data,len,1,f) != 1) @@ -2171,7 +2171,7 @@ public: default: return -1; } - FILE *f = fopen(p,"r"); + FILE *f = fopen(p,"rb"); if (f) { int n = (int)fread(data,1,maxlen,f); fclose(f);