watchdog: Fix enabled value type
When deserializing a bool with sd_bus_message_read, it expects the
storage of the passed in container to be 4 bytes. A bool is not
guaranteed to be this large and will cause sd_bus_message_read to
scribble on the stack. Change enabled to int to guarantee enough
space to deserialize the result.
For reference libsystemd is doing:
*(int*) p = !!*(uint8_t*) q;
Change-Id: Ic299e303fcb70941757c453a7b4f643337220afb
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/app/watchdog.cpp b/app/watchdog.cpp
index 7b04faa..da83ca3 100644
--- a/app/watchdog.cpp
+++ b/app/watchdog.cpp
@@ -125,7 +125,7 @@
char *busname = NULL;
// Current properties of the watchdog daemon.
- bool enabled = false;
+ int enabled = 0;
uint64_t interval = 0;
// Status code.