shutdown: paranoia, switch to secure_getenv()

We have this rule in systemd that unless we are sure that getenv() is
safe and there's a reason to use it we should always prefer
secure_getenv(). Follow our own rules here, as per CODING_STYLE
document.

This really doesn't matter here, all of this is highly privileged, but
hopefully Claude & Colleagues shut up about this then, and maybe detect
the pattern better.
This commit is contained in:
Lennart Poettering
2026-04-04 22:49:47 +02:00
parent 047ae265cc
commit e7182635c6
+3 -3
View File
@@ -286,14 +286,14 @@ static void init_watchdog(void) {
const char *s;
int r;
s = getenv("WATCHDOG_DEVICE");
s = secure_getenv("WATCHDOG_DEVICE");
if (s) {
r = watchdog_set_device(s);
if (r < 0)
log_warning_errno(r, "Failed to set watchdog device to %s, ignoring: %m", s);
log_warning_errno(r, "Failed to set watchdog device to '%s', ignoring: %m", s);
}
s = getenv("WATCHDOG_USEC");
s = secure_getenv("WATCHDOG_USEC");
if (s) {
usec_t usec;