From 4bd359f8f0ea3488ffa8b553088c96f662930b86 Mon Sep 17 00:00:00 2001 From: Dirk Thomas Date: Tue, 3 Nov 2015 14:47:34 -0800 Subject: [PATCH] fix warning about ignored return value --- rclcpp/include/rclcpp/utilities.hpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/rclcpp/include/rclcpp/utilities.hpp b/rclcpp/include/rclcpp/utilities.hpp index fb913ba..9772466 100644 --- a/rclcpp/include/rclcpp/utilities.hpp +++ b/rclcpp/include/rclcpp/utilities.hpp @@ -140,7 +140,15 @@ init(int argc, char * argv[]) const size_t error_length = 1024; char error_string[error_length]; #ifndef _WIN32 - strerror_r(errno, error_string, error_length); + auto rc = strerror_r(errno, error_string, error_length); + if (rc) { + // *INDENT-OFF* + throw std::runtime_error( + "Failed to set SIGINT signal handler: (" + std::to_string(errno) + + ") unable to retrieve error string"); + // *INDENT-ON* + } + #else strerror_s(error_string, error_length, errno); #endif