#include "log.h"
static int watchdog_fd = -1;
-static usec_t watchdog_timeout = (usec_t) -1;
+static usec_t watchdog_timeout = USEC_INFINITY;
static int update_timeout(void) {
int r;
if (watchdog_fd < 0)
return 0;
- if (watchdog_timeout == (usec_t) -1)
+ if (watchdog_timeout == USEC_INFINITY)
return 0;
else if (watchdog_timeout == 0) {
int flags;
}
watchdog_timeout = (usec_t) sec * USEC_PER_SEC;
- log_info("Set hardware watchdog to %s.", format_timespan(buf, sizeof(buf), watchdog_timeout));
+ log_info("Set hardware watchdog to %s.", format_timespan(buf, sizeof(buf), watchdog_timeout, 0));
flags = WDIOS_ENABLECARD;
r = ioctl(watchdog_fd, WDIOC_SETOPTIONS, &flags);
/* If we didn't open the watchdog yet and didn't get any
* explicit timeout value set, don't do anything */
- if (watchdog_fd < 0 && watchdog_timeout == (usec_t) -1)
+ if (watchdog_fd < 0 && watchdog_timeout == USEC_INFINITY)
return 0;
if (watchdog_fd < 0)
}
}
- close_nointr_nofail(watchdog_fd);
- watchdog_fd = -1;
+ watchdog_fd = safe_close(watchdog_fd);
}