SHA256
1
0
forked from pool/systemd
systemd/0007-sd-event-don-t-accidentally-turn-of-watchdog-timer-e.patch

30 lines
1001 B
Diff
Raw Normal View History

From 75145780813957ecbe6835f2c8bc20113a3605d2 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Tue, 25 Mar 2014 00:01:51 +0100
Subject: [PATCH] sd-event: don't accidentally turn of watchdog timer event if
we determine 0
---
src/libsystemd/sd-event/sd-event.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git src/libsystemd/sd-event/sd-event.c src/libsystemd/sd-event/sd-event.c
index d6a3d1c..4aabec1 100644
--- src/libsystemd/sd-event/sd-event.c
+++ src/libsystemd/sd-event/sd-event.c
@@ -2087,6 +2087,11 @@ static int arm_watchdog(sd_event *e) {
timespec_store(&its.it_value, t);
+ /* Make sure we never set the watchdog to 0, which tells the
+ * kernel to disable it. */
+ if (its.it_value.tv_sec == 0 && its.it_value.tv_nsec == 0)
+ its.it_value.tv_nsec = 1;
+
r = timerfd_settime(e->watchdog_fd, TFD_TIMER_ABSTIME, &its, NULL);
if (r < 0)
return -errno;
--
1.7.9.2