From 8eb0c7917da9d991c299206a32ba83e560d90f42 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 7 Feb 2022 10:59:05 +0100 Subject: [PATCH] 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: f4b1a6b6419b771d26342a9b75b1d77ee9d90133 --- src/shared/watchdog.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/shared/watchdog.c b/src/shared/watchdog.c index e4cc0926f7..f29d3761b0 100644 --- a/src/shared/watchdog.c +++ b/src/shared/watchdog.c @@ -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) -- 2.25.1