summaryrefslogtreecommitdiffstats
path: root/src/ipsw.c
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2012-07-17 16:06:57 +0200
committerGravatar Nikias Bassen2012-07-17 16:06:57 +0200
commitfb4a61aff5c45cb775e80e3b55d43f733b01e420 (patch)
treedebb216c8990ac57b8b0264f9a3d673059ed3bf7 /src/ipsw.c
parent91a94c556245a74c0a7187388688178c11fceaa1 (diff)
downloadidevicerestore-fb4a61aff5c45cb775e80e3b55d43f733b01e420.tar.gz
idevicerestore-fb4a61aff5c45cb775e80e3b55d43f733b01e420.tar.bz2
ipsw: Remove downloaded file if checksum verification failed
This prevents restore attempts with corrupt firmware IPSW files.
Diffstat (limited to 'src/ipsw.c')
-rw-r--r--src/ipsw.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/ipsw.c b/src/ipsw.c
index 9c78da9..a66d4b1 100644
--- a/src/ipsw.c
+++ b/src/ipsw.c
@@ -461,6 +461,10 @@ int ipsw_download_latest_fw(plist_t version_data, const char* product, const cha
res = -1;
}
fclose(f);
+
+ // make sure to remove invalid files
+ if (res < 0)
+ remove(fwlfn);
} else {
error("ERROR: Can't open '%s' for checksum verification\n", fwlfn);
res = -1;