80 lines
2.1 KiB
Diff
80 lines
2.1 KiB
Diff
From 3fb4693cc10a81f32e850e5efef999cb2f06d1e9 Mon Sep 17 00:00:00 2001
|
|
From: Alexander Aring <aahringo@redhat.com>
|
|
Date: Aug 17 2023 17:06:18 +0000
|
|
Subject: dlm_controld: fix various deadcode issues
|
|
|
|
|
|
This patch fix various deadcode issues discovered by coverity. The flags
|
|
from the shutdown_callback() aren't flags, we need to use == to get the
|
|
shutdown request type. The value COROSYNC_CFG_SHUTDOWN_FLAG_REQUEST is 0
|
|
and will never be true in this case.
|
|
|
|
The strstr() need to be incremented after checking on NULL.
|
|
|
|
The &dlm_options[ind] can't never be NULL, we check if name is check to
|
|
indicate an entry which is not being used.
|
|
|
|
---
|
|
|
|
diff --git a/dlm_controld/config.c b/dlm_controld/config.c
|
|
index b15527b..9332bd2 100644
|
|
--- a/dlm_controld/config.c
|
|
+++ b/dlm_controld/config.c
|
|
@@ -286,7 +286,7 @@ void set_opt_file(int update)
|
|
if (ind < 0)
|
|
continue;
|
|
o = &dlm_options[ind];
|
|
- if (!o)
|
|
+ if (!o->name)
|
|
continue;
|
|
|
|
scanned_dlm_opt[ind] = 1;
|
|
diff --git a/dlm_controld/lib.c b/dlm_controld/lib.c
|
|
index a21150f..3ff0680 100644
|
|
--- a/dlm_controld/lib.c
|
|
+++ b/dlm_controld/lib.c
|
|
@@ -269,10 +269,13 @@ static unsigned int kv(char *str, const char *k)
|
|
if (!p)
|
|
return 0;
|
|
|
|
- p = strstr(p, "=") + 1;
|
|
+ p = strstr(p, "=");
|
|
if (!p)
|
|
return 0;
|
|
|
|
+ /* move pointer after '=' */
|
|
+ p++;
|
|
+
|
|
memset(valstr, 0, 64);
|
|
|
|
for (i = 0; i < 64; i++) {
|
|
@@ -299,10 +302,13 @@ static char *ks(char *str, const char *k)
|
|
if (!p)
|
|
return 0;
|
|
|
|
- p = strstr(p, "=") + 1;
|
|
+ p = strstr(p, "=");
|
|
if (!p)
|
|
return 0;
|
|
|
|
+ /* move pointer after '=' */
|
|
+ p++;
|
|
+
|
|
memset(valstr, 0, 64);
|
|
|
|
for (i = 0; i < 64; i++) {
|
|
diff --git a/dlm_controld/member.c b/dlm_controld/member.c
|
|
index d567c11..f297b45 100644
|
|
--- a/dlm_controld/member.c
|
|
+++ b/dlm_controld/member.c
|
|
@@ -345,7 +345,7 @@ void kick_node_from_cluster(int nodeid)
|
|
static void shutdown_callback(corosync_cfg_handle_t h,
|
|
corosync_cfg_shutdown_flags_t flags)
|
|
{
|
|
- if (flags & COROSYNC_CFG_SHUTDOWN_FLAG_REQUEST) {
|
|
+ if (flags == COROSYNC_CFG_SHUTDOWN_FLAG_REQUEST) {
|
|
if (list_empty(&lockspaces)) {
|
|
log_debug("shutdown request yes");
|
|
corosync_cfg_replyto_shutdown(ch, COROSYNC_CFG_SHUTDOWN_FLAG_YES);
|
|
|