From 55a206228d575484e97a231c95a9944eb27a2601 Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Wed, 26 Apr 2017 15:46:49 +0200 Subject: [PATCH] Fix: correctly count (un)subscribed signals. Can't be 0 subscription so success if greater than 0 Change-Id: Ie4395dbabe4ed85fe939ebdfa9de87e210fa55bc Signed-off-by: Romain Forlot --- CAN-binder/low-can-binding/low-can-binding.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CAN-binder/low-can-binding/low-can-binding.cpp b/CAN-binder/low-can-binding/low-can-binding.cpp index e6af92cc..484bb5c7 100644 --- a/CAN-binder/low-can-binding/low-can-binding.cpp +++ b/CAN-binder/low-can-binding/low-can-binding.cpp @@ -173,12 +173,12 @@ static int subscribe_unsubscribe_signals(struct afb_req request, bool subscribe, for(const auto& sig: signals.can_signals) { if(conf.get_can_bus_manager().create_rx_filter(*sig) <= 0 && - subscribe_unsubscribe_signal(request, subscribe, sig->get_name()) <= 0) + subscribe_unsubscribe_signal(request, subscribe, sig->get_name()) <=0 ) { return -1; - rets++; - DEBUG(binder_interface, "%s: signal: %s subscribed", __FUNCTION__, sig->get_name().c_str()); } + rets++; + DEBUG(binder_interface, "%s: signal: %s subscribed", __FUNCTION__, sig->get_name().c_str()); } return rets; } @@ -236,7 +236,7 @@ extern "C" } NOTICE(binder_interface, "%s: Subscribed/unsubscribe correctly to %d/%d signal(s).", __FUNCTION__, ok, total); - if (ok) + if (ok > 0) afb_req_success(request, NULL, NULL); else afb_req_fail(request, "error", NULL); -- 2.16.6