mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-05 20:13:44 +02:00
Make sure fopen is in binary mode on Windows.
This commit is contained in:
parent
beb170e4fb
commit
916077012e
1 changed files with 4 additions and 4 deletions
|
@ -2118,7 +2118,7 @@ public:
|
||||||
// Check to see if we've already written this first. This reduces
|
// Check to see if we've already written this first. This reduces
|
||||||
// redundant writes and I/O overhead on most platforms and has
|
// redundant writes and I/O overhead on most platforms and has
|
||||||
// little effect on others.
|
// little effect on others.
|
||||||
f = fopen(p,"r");
|
f = fopen(p,"rb");
|
||||||
if (f) {
|
if (f) {
|
||||||
char buf[65535];
|
char buf[65535];
|
||||||
long l = (long)fread(buf,1,sizeof(buf),f);
|
long l = (long)fread(buf,1,sizeof(buf),f);
|
||||||
|
@ -2127,10 +2127,10 @@ public:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
f = fopen(p,"w");
|
f = fopen(p,"wb");
|
||||||
if ((!f)&&(dirname[0])) { // create subdirectory if it does not exist
|
if ((!f)&&(dirname[0])) { // create subdirectory if it does not exist
|
||||||
OSUtils::mkdir(dirname);
|
OSUtils::mkdir(dirname);
|
||||||
f = fopen(p,"w");
|
f = fopen(p,"wb");
|
||||||
}
|
}
|
||||||
if (f) {
|
if (f) {
|
||||||
if (fwrite(data,len,1,f) != 1)
|
if (fwrite(data,len,1,f) != 1)
|
||||||
|
@ -2171,7 +2171,7 @@ public:
|
||||||
default:
|
default:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
FILE *f = fopen(p,"r");
|
FILE *f = fopen(p,"rb");
|
||||||
if (f) {
|
if (f) {
|
||||||
int n = (int)fread(data,1,maxlen,f);
|
int n = (int)fread(data,1,maxlen,f);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
|
Loading…
Add table
Reference in a new issue