diff --git a/client/deps/mqtt/posix_sockets.h b/client/deps/mqtt/posix_sockets.h index 42954f640..a3a53d1b6 100644 --- a/client/deps/mqtt/posix_sockets.h +++ b/client/deps/mqtt/posix_sockets.h @@ -58,7 +58,10 @@ int open_nb_socket(const char *addr, const char *port) { // make non-blocking if (sockfd != -1) { - fcntl(sockfd, F_SETFL, fcntl(sockfd, F_GETFL) | O_NONBLOCK); + if(fcntl(sockfd, F_SETFL, fcntl(sockfd, F_GETFL) | O_NONBLOCK) < 0) { + PrintAndLogEx(ERR, "fcntl failed in open_nb_socket"); + return -1; + } } return sockfd; diff --git a/client/src/uart/uart_posix.c b/client/src/uart/uart_posix.c index 7e569a97a..05c0952b5 100644 --- a/client/src/uart/uart_posix.c +++ b/client/src/uart/uart_posix.c @@ -462,8 +462,7 @@ void uart_close(const serial_port sp) { fl.l_pid = getpid(); // Does the system allows us to place a lock on this file descriptor - int err = fcntl(spu->fd, F_SETLK, &fl); - if (err == -1) { + if (fcntl(spu->fd, F_SETLK, &fl) < 0) { //silent error message as it can be called from uart_open failing modes, e.g. when waiting for port to appear //PrintAndLogEx(ERR, "UART error while closing port"); }