CHG: The input handling for "hf 14b write" is now correct. Thanks Asper for spotting the fault.

Minor code clean up.
Added from Pm3-master which will make this fork one step closer to Pm3-master.
This commit is contained in:
iceman1001
2015-01-07 22:51:34 +01:00
parent c0e6c18bf5
commit 14edfd09c3
7 changed files with 77 additions and 47 deletions

View File

@@ -76,14 +76,14 @@ int saveFile(const char *preferredName, const char *suffix, const void* data, si
/* We should have a valid filename now, e.g. dumpdata-3.bin */
/*Opening file for writing in binary mode*/
FILE *fh=fopen(fileName,"wb");
if(!fh) {
FILE *fileHandle=fopen(fileName,"wb");
if(!fileHandle) {
PrintAndLog("Failed to write to file '%s'", fileName);
free(fh);
free(fileName);
return 1;
}
fwrite(data, 1, datalen, fh);
fclose(fh);
fwrite(data, 1, datalen, fileHandle);
fclose(fileHandle);
PrintAndLog("Saved data to '%s'", fileName);
free(fileName);