From c7f24a92f29180b50c0d92df34310f2179ba24cb Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Thu, 15 Dec 2016 02:57:31 +0100 Subject: idevicebackup2: Fix logical bug when checking for success of backup operation The condition in line 2278 is incorrectly evaluated when mb2_status_check_snapshot_state() isn't able to read the Status.plist file. While `if (-1) { ... }` will be a 'false' condition, `if (1 && -1) { ... }` will be 'true' which in this case would make idevicebackup2 assume the backup was successful while it was not. This commit fixes this issue by changing the default return value of mb2_status_check_snapshot_state() to be 0 (false). Thanks to Xiao Deng for pointing out this issue! --- tools/idevicebackup2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/idevicebackup2.c b/tools/idevicebackup2.c index 8dc32c5..e6c1d3f 100644 --- a/tools/idevicebackup2.c +++ b/tools/idevicebackup2.c @@ -491,7 +491,7 @@ static plist_t mobilebackup_factory_info_plist_new(const char* udid, idevice_t d static int mb2_status_check_snapshot_state(const char *path, const char *udid, const char *matches) { - int ret = -1; + int ret = 0; plist_t status_plist = NULL; char *file_path = string_build_path(path, udid, "Status.plist", NULL); -- cgit v1.1-32-gdbae