summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorGravatar BALATON Zoltan2015-09-23 02:11:54 +0200
committerGravatar BALATON Zoltan2016-04-01 22:53:13 +0200
commit35b0543ec2a54250be011a9ffdd1d70f2c1ced5c (patch)
tree1a84fd6ae1ee31908e33eab829cb5b4e2ec3b48a /tools
parentdf1f5c4d70d0c19ad40072f5246ca457e7f9849e (diff)
downloadlibimobiledevice-35b0543ec2a54250be011a9ffdd1d70f2c1ced5c.tar.gz
libimobiledevice-35b0543ec2a54250be011a9ffdd1d70f2c1ced5c.tar.bz2
idevicebackup: fix some timestamps that are relative to the Mac epoch instead of Unix one
Diffstat (limited to 'tools')
-rw-r--r--tools/idevicebackup.c4
-rw-r--r--tools/idevicebackup2.c7
2 files changed, 6 insertions, 5 deletions
diff --git a/tools/idevicebackup.c b/tools/idevicebackup.c
index 2619cc9..7e825de 100644
--- a/tools/idevicebackup.c
+++ b/tools/idevicebackup.c
@@ -251,7 +251,7 @@ static plist_t mobilebackup_factory_info_plist_new(const char* udid)
if (value_node)
plist_dict_set_item(ret, "IMEI", plist_copy(value_node));
- plist_dict_set_item(ret, "Last Backup Date", plist_new_date(time(NULL), 0));
+ plist_dict_set_item(ret, "Last Backup Date", plist_new_date(time(NULL) - MAC_EPOCH, 0));
value_node = plist_dict_get_item(root_node, "ProductType");
plist_dict_set_item(ret, "Product Type", plist_copy(value_node));
@@ -288,7 +288,7 @@ static void mobilebackup_info_update_last_backup_date(plist_t info_plist)
return;
node = plist_dict_get_item(info_plist, "Last Backup Date");
- plist_set_date_val(node, time(NULL), 0);
+ plist_set_date_val(node, time(NULL) - MAC_EPOCH, 0);
node = NULL;
}
diff --git a/tools/idevicebackup2.c b/tools/idevicebackup2.c
index 934cf39..be5a1a0 100644
--- a/tools/idevicebackup2.c
+++ b/tools/idevicebackup2.c
@@ -146,10 +146,10 @@ static void mobilebackup_afc_get_file_contents(afc_client_t afc, const char *fil
uint32_t bread = 0;
afc_file_read(afc, f, buf+done, 65536, &bread);
if (bread > 0) {
+ done += bread;
} else {
break;
}
- done += bread;
}
if (done == fsize) {
*size = fsize;
@@ -223,7 +223,7 @@ static plist_t mobilebackup_factory_info_plist_new(const char* udid, lockdownd_c
if (value_node)
plist_dict_set_item(ret, "IMEI", plist_copy(value_node));
- plist_dict_set_item(ret, "Last Backup Date", plist_new_date(time(NULL), 0));
+ plist_dict_set_item(ret, "Last Backup Date", plist_new_date(time(NULL) - MAC_EPOCH, 0));
value_node = plist_dict_get_item(root_node, "PhoneNumber");
if (value_node && (plist_get_node_type(value_node) == PLIST_STRING)) {
@@ -914,7 +914,8 @@ static void mb2_handle_list_directory(mobilebackup2_client_t mobilebackup2, plis
}
plist_dict_set_item(fdict, "DLFileType", plist_new_string(ftype));
plist_dict_set_item(fdict, "DLFileSize", plist_new_uint(st.st_size));
- plist_dict_set_item(fdict, "DLFileModificationDate", plist_new_date(st.st_mtime, 0));
+ plist_dict_set_item(fdict, "DLFileModificationDate",
+ plist_new_date(st.st_mtime - MAC_EPOCH, 0));
plist_dict_set_item(dirlist, ep->d_name, fdict);
free(fpath);