summaryrefslogtreecommitdiffstats
path: root/src/restore.c
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2019-01-23 01:19:46 +0100
committerGravatar Nikias Bassen2019-01-23 01:19:46 +0100
commita808accd1e748184933f0e4d97d499d79f34f889 (patch)
tree6635f67416e121c0ca9bb1b1feef3758c47b8a8a /src/restore.c
parente0b44cfb99c7e400c0fc51474f240dba3facd412 (diff)
downloadidevicerestore-a808accd1e748184933f0e4d97d499d79f34f889.tar.gz
idevicerestore-a808accd1e748184933f0e4d97d499d79f34f889.tar.bz2
Replace tempnam() with mkstemp() and provide reference implementation for systems lacking it
Diffstat (limited to 'src/restore.c')
-rw-r--r--src/restore.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/restore.c b/src/restore.c
index 6652aa0..a187dfa 100644
--- a/src/restore.c
+++ b/src/restore.c
@@ -1627,15 +1627,18 @@ int restore_send_baseband_data(restored_client_t restore, struct idevicerestore_
}
// extract baseband firmware to temp file
- bbfwtmp = tempnam(NULL, client->udid);
+ bbfwtmp = get_temp_filename("bbfw_");
if (!bbfwtmp) {
- error("WARNING: Could not generate temporary filename, using bbfw.tmp\n");
- bbfwtmp = strdup("bbfw.tmp");
+ size_t l = strlen(client->udid);
+ bbfwtmp = malloc(l + 10);
+ strcpy(bbfwtmp, "bbfw_");
+ strncpy(bbfwtmp + 5, client->udid, l);
+ strcpy(bbfwtmp + 5 + l, ".tmp");
+ error("WARNING: Could not generate temporary filename, using %s in current directory\n", bbfwtmp);
}
if (ipsw_extract_to_file(client->ipsw, bbfwpath, bbfwtmp) != 0) {
error("ERROR: Unable to extract baseband firmware from ipsw\n");
- plist_free(response);
- return -1;
+ goto leave;
}
if (bb_nonce && !client->restore->bbtss) {