watchdog: use MIN() in update_timeout()
Also the previous expression was probably wrong as "(int) t >= INT_MAX" is likely to always evaluate to false.
This commit is contained in:
@@ -36,7 +36,7 @@ static int update_timeout(void) {
|
||||
usec_t t;
|
||||
|
||||
t = DIV_ROUND_UP(watchdog_timeout, USEC_PER_SEC);
|
||||
sec = (int) t >= INT_MAX ? INT_MAX : t; /* Saturate */
|
||||
sec = MIN(t, (usec_t) INT_MAX); /* Saturate */
|
||||
if (ioctl(watchdog_fd, WDIOC_SETTIMEOUT, &sec) < 0)
|
||||
return log_warning_errno(errno, "Failed to set timeout to %is: %m", sec);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user