From 63f0d95f2a9a26a84ef18728be7e755850f061f9 Mon Sep 17 00:00:00 2001 From: tihmstar Date: Wed, 4 Jan 2017 15:17:16 +0100 Subject: [PATCH] workaround fread windows bug? --- futurerestore/futurerestore.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/futurerestore/futurerestore.cpp b/futurerestore/futurerestore.cpp index b07c8ea3..181565cd 100644 --- a/futurerestore/futurerestore.cpp +++ b/futurerestore/futurerestore.cpp @@ -688,11 +688,14 @@ void futurerestore::loadSep(const char *sepPath){ reterror(-15, "failed to malloc memory for SEP\n"); size_t freadRet=0; - if ((freadRet = fread(_client->sepfwdata, 1, _client->sepfwdatasize, fsep)) != _client->sepfwdatasize) -#ifdef WIN32 - printf("WARNING (WIN32) issue? _client->sepfwdatasize=%d but fread returned=%d\n",_client->sepfwdatasize,freadRet), -#endif - reterror(-15, "failed to load SEP\n"); + //workaroung for windows bug!?!? + do { + size_t cread = fread(_client->sepfwdata, 1, _client->sepfwdatasize, fsep); + if (!cread) + reterror(-15, "failed to load SEP. _client->sepfwdatasize=%zu but fread returned=%zu\n",_client->sepfwdatasize,freadRet); + freadRet += cread; + printf("reading sep %zu of %zu bytes",freadRet,_client->sepfwdatasize); + } while (freadRet < _client->sepfwdatasize); fclose(fsep); }