From: Romain Forlot Date: Mon, 25 Nov 2019 14:04:07 +0000 (+0100) Subject: socketcan-bcm: Fix wrongly opened socket X-Git-Tag: 8.99.5~51 X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F33%2F23233%2F6;p=apps%2Fagl-service-can-low-level.git 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 --- 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 {