Commit 24675d7
committed
cgrulesengd: Fix the return value check in recvfrom
In cgre_receive_netlink_msg::recvfrom(), the return value recv_len is
checked against ENOBUFS, which is an errno value that represents the
last occurred error. However, this comparison has two issues:
First, if the recv_len message bytes are equal to the value of ENOBUFS,
it will return a false positive error.
Second, recv_len is not checked for -1, which indicates an unexpected
event that requires investigation. Fortunately, the next line acts as a
safety net, returning on error conditions and EOF.
Fix this by checking for -1 (error) and comparing errno against ENOBUFS.
Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>1 parent 303e69c commit 24675d7
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
567 | 567 | | |
568 | 568 | | |
569 | 569 | | |
570 | | - | |
| 570 | + | |
571 | 571 | | |
572 | 572 | | |
573 | 573 | | |
| |||
0 commit comments