1
0
mirror of https://github.com/Tha14/toxic.git synced 2025-09-16 07:36:52 +02:00

Make sure we check for duplicate paths in pending file transfers list

This fixes a bug where if you receive multiple file transfer
requests simultaneously and they have the same path the files
will overwrite each other
This commit is contained in:
jfreegman
2022-01-17 10:53:34 -05:00
parent ceb175e3f1
commit 05dbc626e2
3 changed files with 31 additions and 4 deletions

View File

@@ -676,8 +676,10 @@ static void chat_onFileRecv(ToxWindow *self, Tox *m, uint32_t friendnum, uint32_
FILE *filecheck = NULL;
int count = 1;
while ((filecheck = fopen(file_path, "r"))) {
fclose(filecheck);
while ((filecheck = fopen(file_path, "r")) || file_transfer_recv_path_exists(file_path)) {
if (filecheck) {
fclose(filecheck);
}
file_path[path_len] = '\0';
char d[5];