Skip to content

Commit

Permalink
lib: return error code if bf_send() fails
Browse files Browse the repository at this point in the history
bf_send() calls bf_send_request() and bf_recv_response(), both return
non-zero on failure. While the success check is performed on their
return value, once the error is logged errno is returned by bf_send().
Errno is not set by bf_send_request() not bf_recv_response(),
effectively returning 0 from bf_send() and hiding the error.
  • Loading branch information
qdeslandes committed Oct 26, 2024
1 parent 5e5620d commit 15dd233
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/libbpfilter/generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ int bf_send(const struct bf_request *request, struct bf_response **response)

r = bf_send_request(fd, request);
if (r < 0)
return bf_err(errno, "bpfilter: failed to send request to the daemon");
return bf_err(r, "bpfilter: failed to send request to the daemon");

r = bf_recv_response(fd, response);
if (r < 0) {
return bf_err(errno,
return bf_err(r,
"bpfilter: failed to receive response from the daemon");
}

Expand Down

0 comments on commit 15dd233

Please sign in to comment.