summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2016-12-15 02:57:31 +0100
committerGravatar Nikias Bassen2016-12-15 02:57:31 +0100
commitc7f24a92f29180b50c0d92df34310f2179ba24cb (patch)
treeb430985eaf672e82876ad5ce76cea6cf86b8ff89
parentd936514291c0f65ecb0448f3a4aad1b40517f468 (diff)
downloadlibimobiledevice-c7f24a92f29180b50c0d92df34310f2179ba24cb.tar.gz
libimobiledevice-c7f24a92f29180b50c0d92df34310f2179ba24cb.tar.bz2
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!
-rw-r--r--tools/idevicebackup2.c2
1 files changed, 1 insertions, 1 deletions
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);