diff options
Diffstat (limited to 'tools/idevicebackup.c')
| -rw-r--r-- | tools/idevicebackup.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/tools/idevicebackup.c b/tools/idevicebackup.c index c0537b8..363abad 100644 --- a/tools/idevicebackup.c +++ b/tools/idevicebackup.c | |||
| @@ -35,6 +35,7 @@ | |||
| 35 | #include <unistd.h> | 35 | #include <unistd.h> |
| 36 | #include <ctype.h> | 36 | #include <ctype.h> |
| 37 | #include <time.h> | 37 | #include <time.h> |
| 38 | #include <sys/stat.h> | ||
| 38 | 39 | ||
| 39 | #include <libimobiledevice/libimobiledevice.h> | 40 | #include <libimobiledevice/libimobiledevice.h> |
| 40 | #include <libimobiledevice/lockdown.h> | 41 | #include <libimobiledevice/lockdown.h> |
| @@ -51,7 +52,7 @@ | |||
| 51 | #define LOCK_ATTEMPTS 50 | 52 | #define LOCK_ATTEMPTS 50 |
| 52 | #define LOCK_WAIT 200000 | 53 | #define LOCK_WAIT 200000 |
| 53 | 54 | ||
| 54 | #ifdef WIN32 | 55 | #ifdef _WIN32 |
| 55 | #include <windows.h> | 56 | #include <windows.h> |
| 56 | #define sleep(x) Sleep(x*1000) | 57 | #define sleep(x) Sleep(x*1000) |
| 57 | #endif | 58 | #endif |
| @@ -175,7 +176,13 @@ static plist_t mobilebackup_factory_info_plist_new(const char* udid) | |||
| 175 | if (value_node) | 176 | if (value_node) |
| 176 | plist_dict_set_item(ret, "IMEI", plist_copy(value_node)); | 177 | plist_dict_set_item(ret, "IMEI", plist_copy(value_node)); |
| 177 | 178 | ||
| 178 | plist_dict_set_item(ret, "Last Backup Date", plist_new_date(time(NULL) - MAC_EPOCH, 0)); | 179 | plist_dict_set_item(ret, "Last Backup Date", |
| 180 | #ifdef HAVE_PLIST_UNIX_DATE | ||
| 181 | plist_new_unix_date(time(NULL)) | ||
| 182 | #else | ||
| 183 | plist_new_date(time(NULL) - MAC_EPOCH, 0) | ||
| 184 | #endif | ||
| 185 | ); | ||
| 179 | 186 | ||
| 180 | value_node = plist_dict_get_item(root_node, "ProductType"); | 187 | value_node = plist_dict_get_item(root_node, "ProductType"); |
| 181 | plist_dict_set_item(ret, "Product Type", plist_copy(value_node)); | 188 | plist_dict_set_item(ret, "Product Type", plist_copy(value_node)); |
| @@ -212,7 +219,11 @@ static void mobilebackup_info_update_last_backup_date(plist_t info_plist) | |||
| 212 | return; | 219 | return; |
| 213 | 220 | ||
| 214 | node = plist_dict_get_item(info_plist, "Last Backup Date"); | 221 | node = plist_dict_get_item(info_plist, "Last Backup Date"); |
| 222 | #ifdef HAVE_PLIST_UNIX_DATE | ||
| 223 | plist_set_unix_date_val(node, time(NULL)); | ||
| 224 | #else | ||
| 215 | plist_set_date_val(node, time(NULL) - MAC_EPOCH, 0); | 225 | plist_set_date_val(node, time(NULL) - MAC_EPOCH, 0); |
| 226 | #endif | ||
| 216 | 227 | ||
| 217 | node = NULL; | 228 | node = NULL; |
| 218 | } | 229 | } |
| @@ -642,7 +653,7 @@ int main(int argc, char *argv[]) | |||
| 642 | /* we need to exit cleanly on running backups and restores or we cause havok */ | 653 | /* we need to exit cleanly on running backups and restores or we cause havok */ |
| 643 | signal(SIGINT, clean_exit); | 654 | signal(SIGINT, clean_exit); |
| 644 | signal(SIGTERM, clean_exit); | 655 | signal(SIGTERM, clean_exit); |
| 645 | #ifndef WIN32 | 656 | #ifndef _WIN32 |
| 646 | signal(SIGQUIT, clean_exit); | 657 | signal(SIGQUIT, clean_exit); |
| 647 | signal(SIGPIPE, SIG_IGN); | 658 | signal(SIGPIPE, SIG_IGN); |
| 648 | #endif | 659 | #endif |
| @@ -1352,7 +1363,7 @@ files_out: | |||
| 1352 | file_info_path = mobilebackup_build_path(backup_directory, hash, ".mddata"); | 1363 | file_info_path = mobilebackup_build_path(backup_directory, hash, ".mddata"); |
| 1353 | 1364 | ||
| 1354 | /* determine file size */ | 1365 | /* determine file size */ |
| 1355 | #ifdef WIN32 | 1366 | #ifdef _WIN32 |
| 1356 | struct _stati64 fst; | 1367 | struct _stati64 fst; |
| 1357 | if (_stati64(file_info_path, &fst) != 0) | 1368 | if (_stati64(file_info_path, &fst) != 0) |
| 1358 | #else | 1369 | #else |
