From: Lennart Poettering Date: Mon, 7 Feb 2022 09:59:05 +0000 (+0100) Subject: watchdog: work around Coverity confusion X-Git-Tag: v251-rc1~340 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8eb0c7917da9d991c299206a32ba83e560d90f42;p=thirdparty%2Fsystemd.git 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 --- diff --git a/src/shared/watchdog.c b/src/shared/watchdog.c index e4cc0926f78..f29d3761b06 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)