watch: fix uninitialized variable
When building with meson, Jenkins reported the following warning:
```
../watch.cpp: In lambda function:
../watch.cpp:74:30: error: ‘buffer’ may be used uninitialized [-Werror=maybe-uninitialized]
74 | int length = read(fd, buffer.data(), buffer.size());
```
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I39506f3fd08701a3712ebe329b7e7fa3817f26c5
diff --git a/watch.cpp b/watch.cpp
index cfca68e..32853fa 100644
--- a/watch.cpp
+++ b/watch.cpp
@@ -69,8 +69,8 @@
ioPtr = std::make_unique<sdeventplus::source::IO>(
event, fd, EPOLLIN, [this](sdeventplus::source::IO&, int fd, uint32_t) {
- const int size = sizeof(struct inotify_event) + NAME_MAX + 1;
- std::array<char, size> buffer;
+ constexpr int size = sizeof(struct inotify_event) + NAME_MAX + 1;
+ std::array<char, size> buffer{};
int length = read(fd, buffer.data(), buffer.size());
if (length >= static_cast<int>(sizeof(struct inotify_event)))
{