1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-11 09:18:07 +03:00

watchdog: work around Coverity confusion

Coverity (and I, initially) get really confused about "fn"'s validity
here. it doesn't grok that free_and_strdup() is actually a NOP in case
the string isn't changed, and assumes it always invalidates the
specified buffer, which it doesn't do though.

Follow-up for: f4b1a6b641
This commit is contained in:
Lennart Poettering 2022-02-07 10:59:05 +01:00 committed by Frantisek Sumsal
parent 3c84905b08
commit 8eb0c7917d

View File

@ -137,17 +137,17 @@ static int open_watchdog(void) {
if (r < 0)
return log_oom_debug();
watchdog_fd = open(fn, O_WRONLY|O_CLOEXEC);
watchdog_fd = open(watchdog_device, O_WRONLY|O_CLOEXEC);
if (watchdog_fd < 0)
return log_debug_errno(errno, "Failed to open watchdog device %s, ignoring: %m", fn);
return log_debug_errno(errno, "Failed to open watchdog device %s, ignoring: %m", watchdog_device);
if (ioctl(watchdog_fd, WDIOC_GETSUPPORT, &ident) < 0)
log_debug_errno(errno, "Hardware watchdog %s does not support WDIOC_GETSUPPORT ioctl, ignoring: %m", fn);
log_debug_errno(errno, "Hardware watchdog %s does not support WDIOC_GETSUPPORT ioctl, ignoring: %m", watchdog_device);
else
log_info("Using hardware watchdog '%s', version %x, device %s",
ident.identity,
ident.firmware_version,
fn);
watchdog_device);
r = update_timeout();
if (r < 0)