fix coverity #290250
This commit is contained in:
1 parent
fc773ea230
commit
41ad752a95
2 files changed
+5
-3
No files matched your search
@@ -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;
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user