]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/loclass/fileutils.c
ADD: `analyse nuid` - generates NUID 4byte from a UID 7byte. Mifare Classic Ev1...
[proxmark3-svn] / client / loclass / fileutils.c
index e5e5c5b0569270c422c53e83078d738a64f9e106..fd18b96421f50b8b43185e9d3d3b1308b735154c 100644 (file)
@@ -77,17 +77,19 @@ 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 *fileHandle=fopen(fileName,"wb");
-       if(!fileHandle) {
+       FILE *f = fopen(fileName,"wb");
+       if (!f) {
                prnlog("Failed to write to file '%s'", fileName);
                free(fileName);
                return 1;
        }
-       fwrite(data, 1, datalen, fileHandle);
-       fclose(fileHandle);
+       fwrite(data, 1, datalen, f);
+       if (f) {
+               fclose(f);
+               f = NULL;
+       }
        prnlog("Saved data to '%s'", fileName);
        free(fileName);
-
        return 0;
 }
 
Impressum, Datenschutz