From fb4a61aff5c45cb775e80e3b55d43f733b01e420 Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Tue, 17 Jul 2012 16:06:57 +0200 Subject: ipsw: Remove downloaded file if checksum verification failed This prevents restore attempts with corrupt firmware IPSW files. --- src/ipsw.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/ipsw.c') 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; -- cgit v1.1-32-gdbae