On Wed, 17.06.15 17:49, Jean Delvare ([email protected]) wrote: > Not all watchdog drivers implement WDIOC_SETOPTIONS. Drivers which do > not implement it have their device always enabled. So it's fine to > report an error if WDIOS_DISABLECARD is passed and the ioctl is not > implemented, however failing when WDIOS_ENABLECARD is passed and the > ioctl is not implemented is not good: if the device was already > enabled then WDIOS_ENABLECARD was a no-op and wasn't needed in the > first place. So we can just ignore the error and continue. > --- > Changes since v2: > * Fix indentation (spaces not tabs.) > > Changes since v1: > * Log WDIOC_SETOPTIONS/WDIOS_ENABLECARD failure at debug level if > ENOTTY is returned. Suggested by Lennart Poettering. > > src/shared/watchdog.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > --- systemd.orig/src/shared/watchdog.c 2015-06-17 13:09:40.808480605 > +0200 > +++ systemd/src/shared/watchdog.c 2015-06-17 13:09:50.633687681 +0200 > @@ -60,8 +60,13 @@ static int update_timeout(void) { > > flags = WDIOS_ENABLECARD; > r = ioctl(watchdog_fd, WDIOC_SETOPTIONS, &flags); > - if (r < 0) > - return log_warning_errno(errno, "Failed to enable > hardware watchdog: %m"); > + if (r < 0) { > + /* ENOTTY means the watchdog is always enabled so > we're fine */ > + log_full(errno == ENOTTY ? LOG_DEBUG : LOG_WARNING, > + "Failed to enable hardware watchdog: %m"); > + if (errno != ENOTTY) > + return errno; > + }
Sorry, not sure how I missed that, but we return error as negative integers. Must be "return -errno" instead of "return errno" hence. See CODING_STYLE on this. Lennart -- Lennart Poettering, Red Hat _______________________________________________ systemd-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/systemd-devel
