Fix checking return values from usbmuxd
diff --git a/src/libusbmuxd.c b/src/libusbmuxd.c index eaba498..2bea51a 100644 --- a/src/libusbmuxd.c +++ b/src/libusbmuxd.c
@@ -1105,7 +1105,7 @@ } else { uint32_t rc = 0; plist_t pl = NULL; - if (usbmuxd_get_result(sfd, use_tag, &rc, &pl)) { + if (usbmuxd_get_result(sfd, use_tag, &rc, &pl) && (rc == 0)) { plist_t node = plist_dict_get_item(pl, "BUID"); if (node && plist_get_node_type(node) == PLIST_STRING) { plist_get_string_val(node, buid); @@ -1146,7 +1146,7 @@ } else { uint32_t rc = 0; plist_t pl = NULL; - if (usbmuxd_get_result(sfd, use_tag, &rc, &pl)) { + if (usbmuxd_get_result(sfd, use_tag, &rc, &pl) && (rc == 0)) { plist_t node = plist_dict_get_item(pl, "PairRecordData"); if (node && plist_get_node_type(node) == PLIST_DATA) { uint64_t int64val = 0; @@ -1190,7 +1190,7 @@ DEBUG(1, "%s: Error sending SavePairRecord message!\n", __func__); } else { uint32_t rc = 0; - if (usbmuxd_get_result(sfd, use_tag, &rc, NULL)) { + if (usbmuxd_get_result(sfd, use_tag, &rc, NULL) && (rc == 0)) { ret = 0; } else { ret = -(int)rc; @@ -1225,7 +1225,7 @@ DEBUG(1, "%s: Error sending DeletePairRecord message!\n", __func__); } else { uint32_t rc = 0; - if (usbmuxd_get_result(sfd, use_tag, &rc, NULL)) { + if (usbmuxd_get_result(sfd, use_tag, &rc, NULL) && (rc == 0)) { ret = 0; } else { ret = -(int)rc;