aboutsummaryrefslogtreecommitdiffstats
path: root/low-can-binding/utils/socketcan-bcm.cpp
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2019-11-25 15:04:07 +0100
committerRomain Forlot <romain.forlot@iot.bzh>2020-01-09 15:55:03 +0100
commitd1530f94446bf69599664b0341be35317e18b8b5 (patch)
tree101a0e86b4b4fc73843c7338698acedecc363f6f /low-can-binding/utils/socketcan-bcm.cpp
parent3f5047992019f9c1d436deb13447a010f0295f02 (diff)
socketcan-bcm: Fix wrongly opened socket
This commit fixes a problem once a bcm socket has been opened but the following ioctl failed. Before we still return the socket number instead of returning a negative value as error. This resulted in problem because the subscription was considered as valid and binding was continuing using the closed file descriptor. Bug-AGL: SPEC-2988 Change-Id: Iaa64e7bb00980cb8c0e7080aca238cfb57d628b6 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'low-can-binding/utils/socketcan-bcm.cpp')
-rw-r--r--low-can-binding/utils/socketcan-bcm.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/low-can-binding/utils/socketcan-bcm.cpp b/low-can-binding/utils/socketcan-bcm.cpp
index e992ccbe..515b2fb3 100644
--- a/low-can-binding/utils/socketcan-bcm.cpp
+++ b/low-can-binding/utils/socketcan-bcm.cpp
@@ -44,6 +44,7 @@ namespace utils
{
AFB_ERROR("ioctl failed. Error was : %s", strerror(errno));
close();
+ return -1;
}
else
{