summaryrefslogtreecommitdiff
path: root/emulator/phy.c
diff options
context:
space:
mode:
authorTedd Ho-Jeong An <hj.tedd.an@gmail.com>2020-11-20 12:07:10 -0800
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2020-11-24 13:03:46 -0800
commit8d23082905394e2a6d7d8c5ad334c6c14d2216de (patch)
tree8326720b48dc2e2396c18b487b9f188ed99b14e4 /emulator/phy.c
parent66b360a5bad4de40f32706bc2d063e10d6925578 (diff)
downloadbluez-8d23082905394e2a6d7d8c5ad334c6c14d2216de.tar.gz
emulator: Fix the unchecked return value
This patch fixes the unchecked return value.
Diffstat (limited to 'emulator/phy.c')
-rw-r--r--emulator/phy.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/emulator/phy.c b/emulator/phy.c
index 4517ad107..2ae6ad3a2 100644
--- a/emulator/phy.c
+++ b/emulator/phy.c
@@ -115,7 +115,10 @@ static int create_rx_socket(void)
if (fd < 0)
return -1;
- setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt));
+ if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)) < 0) {
+ close(fd);
+ return -1;
+ }
memset(&addr, 0, sizeof(addr));
addr.sin_family = AF_INET;
@@ -138,7 +141,10 @@ static int create_tx_socket(void)
if (fd < 0)
return -1;
- setsockopt(fd, SOL_SOCKET, SO_BROADCAST, &opt, sizeof(opt));
+ if (setsockopt(fd, SOL_SOCKET, SO_BROADCAST, &opt, sizeof(opt)) < 0) {
+ close(fd);
+ return -1;
+ }
return fd;
}