summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--protocols/Discord/src/proto.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/protocols/Discord/src/proto.cpp b/protocols/Discord/src/proto.cpp
index 52af24578d..991327a38d 100644
--- a/protocols/Discord/src/proto.cpp
+++ b/protocols/Discord/src/proto.cpp
@@ -464,6 +464,7 @@ void CDiscordProto::SendFileThread(void *param)
FILE *in = _wfopen(p->wszFileName, L"rb");
if (in == NULL) {
+ debugLogA("cannot open file %S for reading", p->wszFileName.c_str());
LBL_Error:
ProtoBroadcastAck(p->hContact, ACKTYPE_FILE, ACKRESULT_FAILED, param);
delete p;
@@ -516,8 +517,11 @@ void CDiscordProto::SendFileThread(void *param)
memcpy(pReq->pData, szBody.c_str(), szBody.GetLength());
size_t cbRead = fread(pReq->pData + szBody.GetLength(), 1, cbBytes, in);
fclose(in);
- if (cbBytes != cbRead)
+ if (cbBytes != cbRead) {
+ debugLogA("cannot read file %S: %d bytes read instead of %d", p->wszFileName.c_str(), cbRead, cbBytes);
+ delete pReq;
goto LBL_Error;
+ }
memcpy(pReq->pData + szBody.GetLength() + cbBytes, szBoundary, szBoundary.GetLength());
pReq->pUserInfo = p;