uart.c: check return of read()
Fix warning uart.c:146:3: warning: ignoring return value of 'read', declared with attribute warn_unused_result [-Wunused-result] Also reported by Coverity: CID undefined (#1 of 1): Ignoring number of bytes read (CHECKED_RETURN) check_return: "read(int, void *, size_t)" returns the number of bytes read, but it is ignored.
This commit is contained in:
parent
b5d76a327d
commit
70048a0b2c
1 changed files with 5 additions and 1 deletions
|
@ -143,7 +143,11 @@ uart_flush_input(serial_port sp)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// There is something available, read the data
|
// There is something available, read the data
|
||||||
(void)read(UART_DATA(sp)->fd, rx, available_bytes_count);
|
if (read(UART_DATA(sp)->fd, rx, available_bytes_count) < 0) {
|
||||||
|
perror("uart read");
|
||||||
|
free(rx);
|
||||||
|
return;
|
||||||
|
}
|
||||||
log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_DEBUG, "%d bytes have eaten.", available_bytes_count);
|
log_put(LOG_GROUP, LOG_CATEGORY, NFC_LOG_PRIORITY_DEBUG, "%d bytes have eaten.", available_bytes_count);
|
||||||
free(rx);
|
free(rx);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue