From 8e14104246f813248d68baefe4fb43799fe47bad Mon Sep 17 00:00:00 2001 From: Sid Faber <56845980+SidFaber@users.noreply.github.com> Date: Wed, 29 Apr 2020 17:38:00 -0400 Subject: [PATCH] Fix error message (#175) Only generate "Recompile with '-DENABLESECURITY=ON' error when ROS_SECURITY_STRATEGY="Enforce" Signed-off-by: Sid Faber --- rmw_cyclonedds_cpp/src/rmw_node.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/rmw_cyclonedds_cpp/src/rmw_node.cpp b/rmw_cyclonedds_cpp/src/rmw_node.cpp index e4f5e5a..bfa6261 100644 --- a/rmw_cyclonedds_cpp/src/rmw_node.cpp +++ b/rmw_cyclonedds_cpp/src/rmw_node.cpp @@ -851,11 +851,12 @@ rmw_ret_t configure_qos_for_security( return ret; #else (void) qos; - (void) security_options; - RMW_SET_ERROR_MSG( - "Security was requested but the Cyclone DDS being used does not have security " - "support enabled. Recompile Cyclone DDS with the '-DENABLE_SECURITY=ON' " - "CMake option"); + if (security_options->enforce_security == RMW_SECURITY_ENFORCEMENT_ENFORCE) { + RMW_SET_ERROR_MSG( + "Security was requested but the Cyclone DDS being used does not have security " + "support enabled. Recompile Cyclone DDS with the '-DENABLE_SECURITY=ON' " + "CMake option"); + } return RMW_RET_UNSUPPORTED; #endif }