Fix new watchdog timer environment check

This would of course cause a segfault if the environment variable isn't
defined. The regression was introduced in
8873c11e1d.
This commit is contained in:
Robbert van der Helm
2021-06-22 18:06:04 +02:00
parent 4ab61a77b7
commit 75cfc8eaac
+3 -1
View File
@@ -70,7 +70,9 @@ bool is_watchdog_timer_disabled() {
// This is safe because we're not storing the pointer anywhere and the
// environment doesn't get modified anywhere
// NOLINTNEXTLINE(concurrency-mt-unsafe)
return getenv(disable_watchdog_timer_env_var) == "1"sv;
const char* disable_watchdog_env = getenv(disable_watchdog_timer_env_var);
return disable_watchdog_env && disable_watchdog_env == "1"sv;
}
bool pid_running(pid_t pid) {