summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2012-07-28 17:48:45 +0200
committerGravatar Nikias Bassen2012-07-28 17:48:45 +0200
commit137672c4d1e9c8aff4a430dfb85929115b7d052e (patch)
tree8e8d3bdf203aa37bea55711c6fa77745f41e1838 /src
parente2da5f0e79c9a63e12ef37d2fd087bcbff4c967d (diff)
downloadidevicerestore-137672c4d1e9c8aff4a430dfb85929115b7d052e.tar.gz
idevicerestore-137672c4d1e9c8aff4a430dfb85929115b7d052e.tar.bz2
main: use cache_dir/shsh instead of ./shsh if a cache dir was given
Diffstat (limited to 'src')
-rw-r--r--src/idevicerestore.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/idevicerestore.c b/src/idevicerestore.c
index d38e672..0397ec4 100644
--- a/src/idevicerestore.c
+++ b/src/idevicerestore.c
@@ -635,9 +635,15 @@ int main(int argc, char* argv[]) {
uint32_t blen = 0;
plist_to_bin(client->tss, &bin, &blen);
if (bin) {
- char zfn[512];
- sprintf(zfn, "shsh/" FMT_qu "-%s-%s.shsh", (long long int)client->ecid, client->device->product, client->version);
- __mkdir("shsh", 0755);
+ char zfn[1024];
+ if (client->cache_dir) {
+ strcpy(zfn, client->cache_dir);
+ strcat(zfn, "/shsh");
+ } else {
+ strcpy(zfn, "shsh");
+ }
+ mkdir_with_parents(zfn, 0755);
+ sprintf(zfn+strlen(zfn), "/" FMT_qu "-%s-%s.shsh", (long long int)client->ecid, client->device->product, client->version);
struct stat fst;
if (stat(zfn, &fst) != 0) {
gzFile zf = gzopen(zfn, "wb");
@@ -1260,9 +1266,13 @@ int get_shsh_blobs(struct idevicerestore_client_t* client, uint64_t ecid, unsign
error("checking for local shsh\n");
/* first check for local copy */
- char zfn[512];
+ char zfn[1024];
if (client->version) {
- sprintf(zfn, "shsh/" FMT_qu "-%s-%s.shsh", (long long int)client->ecid, client->device->product, client->version);
+ if (client->cache_dir) {
+ sprintf(zfn, "%s/shsh/" FMT_qu "-%s-%s.shsh", client->cache_dir, (long long int)client->ecid, client->device->product, client->version);
+ } else {
+ sprintf(zfn, "shsh/" FMT_qu "-%s-%s.shsh", (long long int)client->ecid, client->device->product, client->version);
+ }
struct stat fst;
if (stat(zfn, &fst) == 0) {
gzFile zf = gzopen(zfn, "rb");