Fix ignoring the number of bytes read, warning reported by Coverity
tool:
CID 258286 (#2 of 2): Ignoring number of bytes read (CHECKED_RETURN).
check_return: read(int, void *, size_t) returns the number of bytes
read, but it is ignored.
In cgre_receive_unix_domain_msg(), the number of bytes read() is
ignored, while reading from the flag value from the socket. Coverity
warns on not checking the number of bytes read, fix it.
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
(cherry picked from commit
23cee33b4d2c856c1c442f7dfed1237a5e52e2a3)
socklen_t caddr_len;
struct stat buff_stat;
char path[FILENAME_MAX];
+ size_t ret_len;
caddr_len = sizeof(caddr);
fd_client = accept(sk_unix, (struct sockaddr *)&caddr, &caddr_len);
pid);
goto close;
}
- if (read(fd_client, &flags, sizeof(flags)) < 0) {
+ ret_len = read(fd_client, &flags, sizeof(flags));
+ if (ret_len != sizeof(flags)) {
flog(LOG_WARNING, "Warning: error reading daemon socket: %s\n",
strerror(errno));
goto close;