dlm_controld: fix various deadcode issues
This commit is contained in:
parent
37bc7f33c1
commit
590d6ad0df
6
dlm.spec
6
dlm.spec
@ -1,6 +1,6 @@
|
||||
Name: dlm
|
||||
Version: 4.2.0
|
||||
Release: 1
|
||||
Release: 2
|
||||
License: GPLv2 and GPLv2+ and LGPLv2+
|
||||
Group: System Environment/Kernel
|
||||
Summary: dlm control daemon and tool
|
||||
@ -14,6 +14,7 @@ BuildRequires: systemd-devel
|
||||
BuildRequires: annobin
|
||||
Source0: https://releases.pagure.org/dlm/%{name}-%{version}.tar.gz
|
||||
Patch0001: 0030-dlm_controld-remove-unnecessary-header-include.patch
|
||||
Patch0002: fix-various-deadcode-issues.patch
|
||||
|
||||
Requires: %{name}-lib = %{version}-%{release}
|
||||
Requires: corosync >= 1.99.9
|
||||
@ -103,6 +104,9 @@ install -Dm 0644 init/dlm.sysconfig %{buildroot}/etc/sysconfig/dlm
|
||||
%{_libdir}/pkgconfig/*.pc
|
||||
|
||||
%changelog
|
||||
* Fri Mar 01 2024 zouzhimin <zouzhimin@kylinos.cn> - 4.2.0-2
|
||||
- dlm_controld: fix various deadcode issues
|
||||
|
||||
* Tue Dec 26 2023 Ge Wang <wang__ge@126.com> - 4.2.0-1
|
||||
- Update to version 4.2.0
|
||||
|
||||
|
||||
79
fix-various-deadcode-issues.patch
Normal file
79
fix-various-deadcode-issues.patch
Normal file
@ -0,0 +1,79 @@
|
||||
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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user