sbd/SOURCES/0013-Refactor-sbd-common-separate-assignment-and-comparis.patch
2021-09-10 04:15:58 +00:00

34 lines
1.1 KiB
Diff

From e13297f45b4c5868800b1d3fc359bfd0723fcc5f Mon Sep 17 00:00:00 2001
From: Klaus Wenninger <klaus.wenninger@aon.at>
Date: Mon, 17 Sep 2018 23:13:37 +0200
Subject: [PATCH] Refactor: sbd-common: separate assignment and comparison
---
src/sbd-common.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/sbd-common.c b/src/sbd-common.c
index fcb7a31..679f946 100644
--- a/src/sbd-common.c
+++ b/src/sbd-common.c
@@ -376,12 +376,13 @@ watchdog_populate_list(void)
snprintf(entry_name, sizeof(entry_name),
SYS_CHAR_DEV_DIR "/%d:%d/device/driver",
major(watchdogs[i]), minor(watchdogs[i]));
- if ((len = readlink(entry_name, buf, sizeof(buf) - 1)) > 0) {
+ len = readlink(entry_name, buf, sizeof(buf) - 1);
+ if (len > 0) {
buf[len] = '\0';
wdg->dev_driver = strdup(basename(buf));
} else if ((wdg->dev_ident) &&
- (strcmp(wdg->dev_ident,
- "Software Watchdog") == 0)) {
+ (strcmp(wdg->dev_ident,
+ "Software Watchdog") == 0)) {
wdg->dev_driver = strdup("softdog");
}
break;
--
1.8.3.1