diff options
author | Nikias Bassen | 2019-10-16 15:46:32 +0200 |
---|---|---|
committer | Nikias Bassen | 2019-10-16 15:46:32 +0200 |
commit | 38e7b85fdde8b3dbf697535f439c96c53564ee72 (patch) | |
tree | 22c274c5c1390e7fe126fe2d8d5b915854390cb8 /src | |
parent | 71d65b39f437811d82739f3862fcc92348766dfb (diff) | |
download | idevicerestore-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')
-rw-r--r-- | src/ipsw.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -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)); |