Fix returned value ((res=f()<0)) => ((res=f())<0); this solves a bug in nfc-relay-picc
This commit is contained in:
parent
0ac3b26982
commit
5876e33e49
4 changed files with 11 additions and 11 deletions
|
@ -1087,7 +1087,7 @@ pn53x_initiator_select_passive_target_ext(struct nfc_device *pnd,
|
|||
if (szTargetsData != 2)
|
||||
return 0; // Target is not ISO14443B2CT
|
||||
uint8_t abtRead[] = { 0xC4 }; // Reading UID_MSB (Read address 4)
|
||||
if ((res = pn53x_initiator_transceive_bytes(pnd, abtRead, sizeof(abtRead), abtTargetsData + 4, sizeof(abtTargetsData) - 4, timeout) < 0)) {
|
||||
if ((res = pn53x_initiator_transceive_bytes(pnd, abtRead, sizeof(abtRead), abtTargetsData + 4, sizeof(abtTargetsData) - 4, timeout)) < 0) {
|
||||
return res;
|
||||
}
|
||||
szTargetsData = 6; // u16 UID_LSB, u8 prod code, u8 fab code, u16 UID_MSB
|
||||
|
@ -1125,7 +1125,7 @@ pn53x_initiator_select_passive_target_ext(struct nfc_device *pnd,
|
|||
if (pnt) {
|
||||
pnt->nm = nm;
|
||||
// Fill the tag info struct with the values corresponding to this init modulation
|
||||
if ((res = pn53x_decode_target_data(abtTargetsData + 1, szTargetsData - 1, CHIP_DATA(pnd)->type, nm.nmt, &(pnt->nti)) < 0)) {
|
||||
if ((res = pn53x_decode_target_data(abtTargetsData + 1, szTargetsData - 1, CHIP_DATA(pnd)->type, nm.nmt, &(pnt->nti))) < 0) {
|
||||
return res;
|
||||
}
|
||||
pn53x_current_target_new(pnd, pnt);
|
||||
|
|
|
@ -315,14 +315,14 @@ acr122_usb_scan(const nfc_context *context, nfc_connstring connstrings[], const
|
|||
// usb_find_busses will find all of the busses on the system. Returns the
|
||||
// number of changes since previous call to this function (total of new
|
||||
// busses and busses removed).
|
||||
if ((res = usb_find_busses() < 0)) {
|
||||
if ((res = usb_find_busses()) < 0) {
|
||||
log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_ERROR, "Unable to find USB busses (%s)", _usb_strerror(res));
|
||||
return 0;
|
||||
}
|
||||
// usb_find_devices will find all of the devices on each bus. This should be
|
||||
// called after usb_find_busses. Returns the number of changes since the
|
||||
// previous call to this function (total of new device and devices removed).
|
||||
if ((res = usb_find_devices() < 0)) {
|
||||
if ((res = usb_find_devices()) < 0) {
|
||||
log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_ERROR, "Unable to find USB devices (%s)", _usb_strerror(res));
|
||||
return 0;
|
||||
}
|
||||
|
@ -452,14 +452,14 @@ acr122_usb_open(const nfc_context *context, const nfc_connstring connstring)
|
|||
// usb_find_busses will find all of the busses on the system. Returns the
|
||||
// number of changes since previous call to this function (total of new
|
||||
// busses and busses removed).
|
||||
if ((res = usb_find_busses() < 0)) {
|
||||
if ((res = usb_find_busses()) < 0) {
|
||||
log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_ERROR, "Unable to find USB busses (%s)", _usb_strerror(res));
|
||||
goto free_mem;
|
||||
}
|
||||
// usb_find_devices will find all of the devices on each bus. This should be
|
||||
// called after usb_find_busses. Returns the number of changes since the
|
||||
// previous call to this function (total of new device and devices removed).
|
||||
if ((res = usb_find_devices() < 0)) {
|
||||
if ((res = usb_find_devices()) < 0) {
|
||||
log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_ERROR, "Unable to find USB devices (%s)", _usb_strerror(res));
|
||||
goto free_mem;
|
||||
}
|
||||
|
|
|
@ -191,14 +191,14 @@ pn53x_usb_scan(const nfc_context *context, nfc_connstring connstrings[], const s
|
|||
// usb_find_busses will find all of the busses on the system. Returns the
|
||||
// number of changes since previous call to this function (total of new
|
||||
// busses and busses removed).
|
||||
if ((res = usb_find_busses() < 0)) {
|
||||
if ((res = usb_find_busses()) < 0) {
|
||||
log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_ERROR, "Unable to find USB busses (%s)", _usb_strerror(res));
|
||||
return 0;
|
||||
}
|
||||
// usb_find_devices will find all of the devices on each bus. This should be
|
||||
// called after usb_find_busses. Returns the number of changes since the
|
||||
// previous call to this function (total of new device and devices removed).
|
||||
if ((res = usb_find_devices() < 0)) {
|
||||
if ((res = usb_find_devices()) < 0) {
|
||||
log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_ERROR, "Unable to find USB devices (%s)", _usb_strerror(res));
|
||||
return 0;
|
||||
}
|
||||
|
@ -336,14 +336,14 @@ pn53x_usb_open(const nfc_context *context, const nfc_connstring connstring)
|
|||
// usb_find_busses will find all of the busses on the system. Returns the
|
||||
// number of changes since previous call to this function (total of new
|
||||
// busses and busses removed).
|
||||
if ((res = usb_find_busses() < 0)) {
|
||||
if ((res = usb_find_busses()) < 0) {
|
||||
log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_ERROR, "Unable to find USB busses (%s)", _usb_strerror(res));
|
||||
goto free_mem;
|
||||
}
|
||||
// usb_find_devices will find all of the devices on each bus. This should be
|
||||
// called after usb_find_busses. Returns the number of changes since the
|
||||
// previous call to this function (total of new device and devices removed).
|
||||
if ((res = usb_find_devices() < 0)) {
|
||||
if ((res = usb_find_devices()) < 0) {
|
||||
log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_ERROR, "Unable to find USB devices (%s)", _usb_strerror(res));
|
||||
goto free_mem;
|
||||
}
|
||||
|
|
|
@ -425,7 +425,7 @@ main(int argc, char *argv[])
|
|||
|
||||
if (!target_only_mode) {
|
||||
// Forward the frame to the original tag
|
||||
if ((res = nfc_initiator_transceive_bytes(pndInitiator, abtCapdu, szCapduLen, abtRapdu, sizeof(abtRapdu), -1) < 0)) {
|
||||
if ((res = nfc_initiator_transceive_bytes(pndInitiator, abtCapdu, szCapduLen, abtRapdu, sizeof(abtRapdu), -1)) < 0) {
|
||||
ret = false;
|
||||
} else {
|
||||
szRapduLen = (size_t) res;
|
||||
|
|
Loading…
Reference in a new issue