- make file-tool example more robust

pull/309/head
Michael Zillgith 5 years ago
parent 8111734f40
commit 5630275a0d

@ -101,13 +101,14 @@ downloadHandler(void* parameter, uint8_t* buffer, uint32_t bytesRead)
printf("received %i bytes\n", bytesRead); printf("received %i bytes\n", bytesRead);
if (fwrite(buffer, bytesRead, 1, fp) == 1) if (bytesRead > 0) {
return true; if (fwrite(buffer, bytesRead, 1, fp) == 1)
else { return true;
printf("Failed to write local file!\n"); else {
return false; printf("Failed to write local file!\n");
return false;
}
} }
} }
static void static void

Loading…
Cancel
Save