summaryrefslogtreecommitdiffstats
path: root/src/fls.c
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2025-06-23 14:00:10 +0200
committerGravatar Nikias Bassen2025-06-23 14:00:10 +0200
commit8061f08b4e0a8f0ab5d1548b7e9978f3cc8647a2 (patch)
tree5e01ac6e10a00c065dc5edf80adbd2ee4ce273e3 /src/fls.c
parenta5905b7f905fc3cc83033ebd963f0dcba071e512 (diff)
downloadidevicerestore-8061f08b4e0a8f0ab5d1548b7e9978f3cc8647a2.tar.gz
idevicerestore-8061f08b4e0a8f0ab5d1548b7e9978f3cc8647a2.tar.bz2
Refactor logging and add logfile support
idevicerestore will now also create a logfile automatically, unless disabled with --logfile=NONE.
Diffstat (limited to 'src/fls.c')
-rw-r--r--src/fls.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/fls.c b/src/fls.c
index f422447..cc75c54 100644
--- a/src/fls.c
+++ b/src/fls.c
@@ -96,7 +96,7 @@ static void fls_parse_elements(fls_file* fls)
offset += cur->size;
} while (offset < fls->size);
if (offset != fls->size) {
- error("ERROR: %s: error parsing elements\n", __func__);
+ logger(LL_ERROR, "%s: error parsing elements\n", __func__);
return;
}
}
@@ -136,22 +136,22 @@ int fls_update_sig_blob(fls_file* fls, const unsigned char* sigdata, unsigned in
{
/* FIXME: the code in this function is not big endian safe */
if (!fls || !fls->num_elements) {
- error("ERROR: %s: no data\n", __func__);
+ logger(LL_ERROR, "%s: no data\n", __func__);
return -1;
}
if (!fls->c_element) {
- error("ERROR: %s: no fls_0c_element in fls data\n", __func__);
+ logger(LL_ERROR, "%s: no fls_0c_element in fls data\n", __func__);
return -1;
}
uint32_t datasize = *(uint32_t*)(fls->c_element->data + 0x10);
if (datasize != fls->c_element->data_size) {
- error("ERROR: %s: data size mismatch (0x%x != 0x%x)\n", __func__, datasize, fls->c_element->data_size);
+ logger(LL_ERROR, "%s: data size mismatch (0x%x != 0x%x)\n", __func__, datasize, fls->c_element->data_size);
return -1;
}
uint32_t sigoffset = *(uint32_t*)(fls->c_element->data + 0x14);
if (sigoffset > datasize) {
- error("ERROR: %s: signature offset greater than data size (0x%x > 0x%x)\n", __func__, sigoffset, datasize);
+ logger(LL_ERROR, "%s: signature offset greater than data size (0x%x > 0x%x)\n", __func__, sigoffset, datasize);
return -1;
}
@@ -162,7 +162,7 @@ int fls_update_sig_blob(fls_file* fls, const unsigned char* sigdata, unsigned in
uint32_t offset = 0;
void* newdata = malloc(newsize);
if (!newdata) {
- error("ERROR: %s: out of memory\n", __func__);
+ logger(LL_ERROR, "%s: out of memory\n", __func__);
return -1;
}
uint32_t hdrsize = 0;
@@ -243,11 +243,11 @@ int fls_insert_ticket(fls_file* fls, const unsigned char* data, unsigned int siz
{
/* FIXME: the code in this function is not big endian safe */
if (!fls || !fls->num_elements) {
- error("ERROR: %s: no data\n", __func__);
+ logger(LL_ERROR, "%s: no data\n", __func__);
return -1;
}
if (!fls->c_element) {
- error("ERROR: %s: no fls_0c_element in fls data\n", __func__);
+ logger(LL_ERROR, "%s: no fls_0c_element in fls data\n", __func__);
return -1;
}
@@ -260,7 +260,7 @@ int fls_insert_ticket(fls_file* fls, const unsigned char* data, unsigned int siz
uint32_t offset = 0;
void* newdata = malloc(newsize);
if (!newdata) {
- error("ERROR: %s: out of memory\n", __func__);
+ logger(LL_ERROR, "%s: out of memory\n", __func__);
return -1;
}
uint32_t hdrsize = 0;