diff --git a/libnfc/drivers/acr122s.c b/libnfc/drivers/acr122s.c index 932d7c0..485c1dc 100644 --- a/libnfc/drivers/acr122s.c +++ b/libnfc/drivers/acr122s.c @@ -477,7 +477,9 @@ acr122s_scan(const nfc_context *context, nfc_connstring connstrings[], const siz DRIVER_DATA(pnd)->seq = 0; #ifndef WIN32 - pipe(DRIVER_DATA(pnd)->abort_fds); + if (pipe(DRIVER_DATA(pnd)->abort_fds) < 0) { + return 0; + } #else DRIVER_DATA(pnd)->abort_flag = false; #endif diff --git a/libnfc/drivers/arygon.c b/libnfc/drivers/arygon.c index e713d4e..c7784d1 100644 --- a/libnfc/drivers/arygon.c +++ b/libnfc/drivers/arygon.c @@ -124,7 +124,9 @@ arygon_scan(const nfc_context *context, nfc_connstring connstrings[], const size #ifndef WIN32 // pipe-based abort mecanism - pipe(DRIVER_DATA(pnd)->iAbortFds); + if (pipe(DRIVER_DATA(pnd)->iAbortFds) < 0) { + return 0; + } #else DRIVER_DATA(pnd)->abort_flag = false; #endif diff --git a/libnfc/drivers/pn532_uart.c b/libnfc/drivers/pn532_uart.c index c3bcd9d..0409ca5 100644 --- a/libnfc/drivers/pn532_uart.c +++ b/libnfc/drivers/pn532_uart.c @@ -101,7 +101,9 @@ pn532_uart_scan(const nfc_context *context, nfc_connstring connstrings[], const #ifndef WIN32 // pipe-based abort mecanism - pipe(DRIVER_DATA(pnd)->iAbortFds); + if (pipe(DRIVER_DATA(pnd)->iAbortFds) < 0) { + return 0; + } #else DRIVER_DATA(pnd)->abort_flag = false; #endif @@ -252,7 +254,9 @@ pn532_uart_open(const nfc_context *context, const nfc_connstring connstring) #ifndef WIN32 // pipe-based abort mecanism - pipe(DRIVER_DATA(pnd)->iAbortFds); + if (pipe(DRIVER_DATA(pnd)->iAbortFds) < 0) { + return NULL; + } #else DRIVER_DATA(pnd)->abort_flag = false; #endif @@ -484,7 +488,9 @@ pn532_uart_abort_command(nfc_device *pnd) if (pnd) { #ifndef WIN32 close(DRIVER_DATA(pnd)->iAbortFds[0]); - pipe(DRIVER_DATA(pnd)->iAbortFds); + if (pipe(DRIVER_DATA(pnd)->iAbortFds) < 0) { + return NFC_ESOFT; + } #else DRIVER_DATA(pnd)->abort_flag = true; #endif diff --git a/libnfc/nfc.c b/libnfc/nfc.c index 7a6ae57..bb3a302 100644 --- a/libnfc/nfc.c +++ b/libnfc/nfc.c @@ -186,7 +186,7 @@ void nfc_exit(nfc_context *context) { while (nfc_drivers) { - struct nfc_driver_list *pndl = nfc_drivers; + struct nfc_driver_list *pndl = (struct nfc_driver_list *) nfc_drivers; nfc_drivers = pndl->next; free(pndl); }