summaryrefslogtreecommitdiffstats
path: root/src/ipsw.c
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2019-10-16 15:46:32 +0200
committerGravatar Nikias Bassen2019-10-16 15:46:32 +0200
commit38e7b85fdde8b3dbf697535f439c96c53564ee72 (patch)
tree22c274c5c1390e7fe126fe2d8d5b915854390cb8 /src/ipsw.c
parent71d65b39f437811d82739f3862fcc92348766dfb (diff)
downloadidevicerestore-38e7b85fdde8b3dbf697535f439c96c53564ee72.tar.gz
idevicerestore-38e7b85fdde8b3dbf697535f439c96c53564ee72.tar.bz2
Fix usage of baseband and potential other components from extracted IPSW
In case realpath fails, the output filename might be not set and thus fopen will fail on it during copy. Setting the resolved output filename to the given output filename in this case fixed the problem.
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 bd02bf9..d1d858b 100644
--- a/src/ipsw.c
+++ b/src/ipsw.c
@@ -231,10 +231,14 @@ int ipsw_extract_to_file_with_progress(const char* ipsw, const char* infile, con
ret = -1;
goto leave;
} else {
+ actual_outfile[0] = '\0';
if (realpath(outfile, actual_outfile) && (strcmp(actual_filepath, actual_outfile) == 0)) {
/* files are identical */
ret = 0;
} else {
+ if (actual_outfile[0] == '\0') {
+ strcpy(actual_outfile, outfile);
+ }
FILE *fi = fopen(actual_filepath, "rb");
if (!fi) {
error("ERROR: fopen: %s: %s\n", actual_filepath, strerror(errno));