summaryrefslogtreecommitdiffstats
path: root/src/ipsw.c
diff options
context:
space:
mode:
authorGravatar Joshua Hill2010-05-24 15:35:08 -0400
committerGravatar Joshua Hill2010-05-24 15:35:08 -0400
commit92c2879d16148f47ff38f3490f24768bb8eb61f6 (patch)
tree4357e98965ecdc2bbb8ce43ef4c8bfc9f2b17c0a /src/ipsw.c
parentdb663abb4d7fd66b5433d46d46b7cdeda22fccdc (diff)
downloadidevicerestore-92c2879d16148f47ff38f3490f24768bb8eb61f6.tar.gz
idevicerestore-92c2879d16148f47ff38f3490f24768bb8eb61f6.tar.bz2
Have it sending DeviceTree now and started on ramdisk. Started to clean up a little bit, but not everything yet.
Diffstat (limited to 'src/ipsw.c')
-rw-r--r--src/ipsw.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/ipsw.c b/src/ipsw.c
index f601201..56fd216 100644
--- a/src/ipsw.c
+++ b/src/ipsw.c
@@ -26,6 +26,13 @@
#include "ipsw.h"
#include "idevicerestore.h"
+typedef struct {
+ struct zip* zip;
+} ipsw_archive;
+
+ipsw_archive* ipsw_open(const char* ipsw);
+void ipsw_close(ipsw_archive* archive);
+
ipsw_archive* ipsw_open(const char* ipsw) {
int err = 0;
ipsw_archive* archive = (ipsw_archive*) malloc(sizeof(ipsw_archive));
@@ -44,7 +51,8 @@ ipsw_archive* ipsw_open(const char* ipsw) {
return archive;
}
-ipsw_file* ipsw_extract_file(ipsw_archive* archive, const char* filename) {
+ipsw_file* ipsw_extract_file(const char* ipsw, const char* filename) {
+ ipsw_archive* archive = ipsw_open(ipsw);
if(archive == NULL || archive->zip == NULL) {
error("ERROR: Invalid archive\n");
return NULL;
@@ -95,6 +103,7 @@ ipsw_file* ipsw_extract_file(ipsw_archive* archive, const char* filename) {
}
zip_fclose(zfile);
+ ipsw_close(archive);
return file;
}