summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2016-08-15 12:54:20 +0200
committerLukas Slebodnik <lslebodn@redhat.com>2016-08-30 10:07:25 +0200
commitd7075a255a1f28e890539072e06d0140ffe0927c (patch)
tree6175ecd085016675496eeab53d659d8350b84aaa
parentfa93cd0f0fc75a6d635079e67788f8a9fe183c3c (diff)
downloadsssd-d7075a255a1f28e890539072e06d0140ffe0927c.tar.gz
sssd-d7075a255a1f28e890539072e06d0140ffe0927c.tar.xz
sssd-d7075a255a1f28e890539072e06d0140ffe0927c.zip
WATCHDOG: define and use _MAX_TICKS as 3
Instead of using the number 3 directly, let's introduce and use WATCHDOG_MAX_TICKS. Reviewed-by: Petr Čech <pcech@redhat.com>
-rw-r--r--src/util/util_watchdog.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/util/util_watchdog.c b/src/util/util_watchdog.c
index 1c27d73f1..c184fbd75 100644
--- a/src/util/util_watchdog.c
+++ b/src/util/util_watchdog.c
@@ -22,6 +22,7 @@
#include "util/util.h"
#define WATCHDOG_DEF_INTERVAL 10
+#define WATCHDOG_MAX_TICKS 3
/* this is intentionally a global variable */
struct watchdog_ctx {
@@ -75,9 +76,8 @@ static void watchdog_handler(int sig)
return;
}
- /* if 3 ticks passed by kills itself */
-
- if (__sync_add_and_fetch(&watchdog_ctx.ticks, 1) > 3) {
+ /* if a pre-defined number of ticks passed by kills itself */
+ if (__sync_add_and_fetch(&watchdog_ctx.ticks, 1) > WATCHDOG_MAX_TICKS) {
DEBUG(SSSDBG_FATAL_FAILURE,
"Watchdog timer overflow, killing process!\n");
orderly_shutdown(1);