Fix GCC 11.1.0 warning
In GCC 11.1.0, there are some new warnings:
/home/vk/git/velia/src/system/IETFSystem.cpp:132:24: error: ‘buffer’ may be used uninitialized [-Werror=maybe-uninitialized]
132 | if (gethostname(buffer.data(), buffer.size()) != 0) {
and
/home/vk/git/velia/src/system/IETFInterfaces.cpp:106:78: error: ‘buf’ may be used uninitialized [-Werror=maybe-uninitialized]
106 | if (const char* res = inet_ntop(addrFamily, binaddr, buf.data(), buf.size()); res != nullptr) {
I'm not sure why exactly these warnings happen, but using `{}` gets rid
of the warning.
Change-Id: Idee9b1cb17a7c0d865a882533064ff71f42cbc71
diff --git a/src/system/IETFSystem.cpp b/src/system/IETFSystem.cpp
index fb433b2..dc6b4b9 100644
--- a/src/system/IETFSystem.cpp
+++ b/src/system/IETFSystem.cpp
@@ -127,7 +127,7 @@
sysrepo::OperGetItemsCb hostNameCbOperational = [] (auto session, auto, auto, auto, auto, auto& parent) {
// + 1 for null-terminating byte, HOST_NAME_MAX doesn't count that
- std::array<char, HOST_NAME_MAX + 1> buffer;
+ std::array<char, HOST_NAME_MAX + 1> buffer{};
if (gethostname(buffer.data(), buffer.size()) != 0) {
throw std::system_error(errno, std::system_category(), "gethostname() failed");