From: Tedd Ho-Jeong An Date: Fri, 20 Nov 2020 20:07:12 +0000 (-0800) Subject: lib: Fix the unchecked return value X-Git-Tag: submit/tizen/20220313.220938~545 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4f5c4c1715986a61d5648f9426f97d0c43bcf4cf;p=platform%2Fupstream%2Fbluez.git lib: Fix the unchecked return value This patch fixes the unchecked return value. Signed-off-by: Anuj Jain Signed-off-by: Ayush Garg --- diff --git a/lib/hci.c b/lib/hci.c index 587716c..6593763 100755 --- a/lib/hci.c +++ b/lib/hci.c @@ -1287,12 +1287,14 @@ int hci_send_req(int dd, struct hci_request *r, int to) failed: err = errno; - setsockopt(dd, SOL_HCI, HCI_FILTER, &of, sizeof(of)); + if (setsockopt(dd, SOL_HCI, HCI_FILTER, &of, sizeof(of)) < 0) + err = errno; errno = err; return -1; done: - setsockopt(dd, SOL_HCI, HCI_FILTER, &of, sizeof(of)); + if (setsockopt(dd, SOL_HCI, HCI_FILTER, &of, sizeof(of)) < 0) + return -1; return 0; } diff --git a/lib/sdp.c b/lib/sdp.c index ebaed3e..844ae0d 100755 --- a/lib/sdp.c +++ b/lib/sdp.c @@ -4705,7 +4705,8 @@ static int sdp_connect_l2cap(const bdaddr_t *src, if (flags & SDP_WAIT_ON_CLOSE) { struct linger l = { .l_onoff = 1, .l_linger = 1 }; - setsockopt(sk, SOL_SOCKET, SO_LINGER, &l, sizeof(l)); + if (setsockopt(sk, SOL_SOCKET, SO_LINGER, &l, sizeof(l)) < 0) + return -1; } if ((flags & SDP_LARGE_MTU) &&