From: Andrei Pavel Date: Thu, 12 Aug 2021 10:21:44 +0000 (+0300) Subject: [#2025] fix Wunused-result warnings X-Git-Tag: Kea-1.9.11~82 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cd5e13cff191a240dcbad2dfcfa91f5a107fcd85;p=thirdparty%2Fkea.git [#2025] fix Wunused-result warnings --- diff --git a/src/lib/yang/tests/sysrepo_setup.h b/src/lib/yang/tests/sysrepo_setup.h index 1d40a77db1..9be4368824 100644 --- a/src/lib/yang/tests/sysrepo_setup.h +++ b/src/lib/yang/tests/sysrepo_setup.h @@ -29,8 +29,22 @@ struct SysrepoSetup { /// is the equivalent of running "make shm_clean" in sysrepo: /// https://github.com/sysrepo/sysrepo/blob/v1.4.140/CMakeLists.txt#L329-L334 static void cleanSharedMemory() { - system("rm -rf /dev/shm/sr_*"); - system("rm -rf /dev/shm/srsub_*"); + call_system("rm -rf /dev/shm/sr_*"); + call_system("rm -rf /dev/shm/srsub_*"); + } + +private: + /// @brief Wrapper over a system() call that also checks the return value. + /// + /// @brief command the command to be run + static void call_system(char const* command) { + int return_value(system(command)); + if (return_value != 0) { + std::cerr << "\"" << command << "\" exited with " << return_value + << ". Unit tests may be influenced by previous abnormaly " + "terminated unit tests or sysrepo uses." + << std::endl; + } } };