Accepting request 548540 from home:BinLiu:branches:network:ha-clustering:Factory
- wd: gcc shows snprintf warnings(bsc#1071187) Added: 0008-wd-fix-snprintf-warnings.patch OBS-URL: https://build.opensuse.org/request/show/548540 OBS-URL: https://build.opensuse.org/package/show/network:ha-clustering:Factory/corosync?expand=0&rev=126
This commit is contained in:
parent
a55efafcf9
commit
85a3c2235b
74
0008-wd-fix-snprintf-warnings.patch
Normal file
74
0008-wd-fix-snprintf-warnings.patch
Normal file
@ -0,0 +1,74 @@
|
||||
From 0906e5717cce87ac8db25ac9a335a63530dba839 Mon Sep 17 00:00:00 2001
|
||||
From: Bin Liu <bliu@suse.com>
|
||||
Date: Fri, 1 Dec 2017 10:58:50 +0800
|
||||
Subject: [PATCH] wd: fix snprintf warnings
|
||||
|
||||
When running ./configure --enable-watchdog, gcc 7.2.1 will report
|
||||
warnings for snprintf. This patch fixes the warnings.
|
||||
|
||||
Signed-off-by: Bin Liu <bliu@suse.com>
|
||||
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
|
||||
---
|
||||
exec/wd.c | 20 ++++++++++----------
|
||||
1 file changed, 10 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/exec/wd.c b/exec/wd.c
|
||||
index 8d0734c9..042d2046 100644
|
||||
--- a/exec/wd.c
|
||||
+++ b/exec/wd.c
|
||||
@@ -221,15 +221,15 @@ static int32_t wd_resource_state_is_ok (struct resource *ref)
|
||||
uint64_t allowed_period;
|
||||
char key_name[ICMAP_KEYNAME_MAXLEN];
|
||||
|
||||
- snprintf(key_name, ICMAP_KEYNAME_MAXLEN, "%s%s", ref->res_path, "last_updated");
|
||||
- if (icmap_get_uint64(key_name, &last_updated) != CS_OK) {
|
||||
+ if ((snprintf(key_name, ICMAP_KEYNAME_MAXLEN, "%s%s", ref->res_path, "last_updated") >= ICMAP_KEYNAME_MAXLEN) ||
|
||||
+ (icmap_get_uint64(key_name, &last_updated) != CS_OK)) {
|
||||
/* key does not exist.
|
||||
*/
|
||||
return CS_FALSE;
|
||||
}
|
||||
|
||||
- snprintf(key_name, ICMAP_KEYNAME_MAXLEN, "%s%s", ref->res_path, "state");
|
||||
- if (icmap_get_string(key_name, &state) != CS_OK || strcmp(state, "disabled") == 0) {
|
||||
+ if ((snprintf(key_name, ICMAP_KEYNAME_MAXLEN, "%s%s", ref->res_path, "state") >= ICMAP_KEYNAME_MAXLEN) ||
|
||||
+ (icmap_get_string(key_name, &state) != CS_OK || strcmp(state, "disabled") == 0)) {
|
||||
/* key does not exist.
|
||||
*/
|
||||
if (state != NULL)
|
||||
@@ -279,8 +279,8 @@ static void wd_config_changed (struct cs_fsm* fsm, int32_t event, void * data)
|
||||
|
||||
next_timeout = ref->check_timeout;
|
||||
|
||||
- snprintf(key_name, ICMAP_KEYNAME_MAXLEN, "%s%s", ref->res_path, "poll_period");
|
||||
- if (icmap_get_uint64(ref->res_path, &tmp_value) == CS_OK) {
|
||||
+ if ((snprintf(key_name, ICMAP_KEYNAME_MAXLEN, "%s%s", ref->res_path, "poll_period") >= ICMAP_KEYNAME_MAXLEN) ||
|
||||
+ (icmap_get_uint64(ref->res_path, &tmp_value) == CS_OK)) {
|
||||
if (tmp_value >= WD_MIN_TIMEOUT_MS && tmp_value <= WD_MAX_TIMEOUT_MS) {
|
||||
log_printf (LOGSYS_LEVEL_DEBUG,
|
||||
"poll_period changing from:%"PRIu64" to %"PRIu64".",
|
||||
@@ -299,8 +299,8 @@ static void wd_config_changed (struct cs_fsm* fsm, int32_t event, void * data)
|
||||
}
|
||||
}
|
||||
|
||||
- snprintf(key_name, ICMAP_KEYNAME_MAXLEN, "%s%s", ref->res_path, "recovery");
|
||||
- if (icmap_get_string(key_name, &ref->recovery) != CS_OK) {
|
||||
+ if ((snprintf(key_name, ICMAP_KEYNAME_MAXLEN, "%s%s", ref->res_path, "recovery") >= ICMAP_KEYNAME_MAXLEN) ||
|
||||
+ (icmap_get_string(key_name, &ref->recovery) != CS_OK)) {
|
||||
/* key does not exist.
|
||||
*/
|
||||
log_printf (LOGSYS_LEVEL_WARNING,
|
||||
@@ -308,8 +308,8 @@ static void wd_config_changed (struct cs_fsm* fsm, int32_t event, void * data)
|
||||
cs_fsm_state_set(&ref->fsm, WD_S_STOPPED, ref, wd_fsm_cb);
|
||||
return;
|
||||
}
|
||||
- snprintf(key_name, ICMAP_KEYNAME_MAXLEN, "%s%s", ref->res_path, "state");
|
||||
- if (icmap_get_string(key_name, &state) != CS_OK) {
|
||||
+ if ((snprintf(key_name, ICMAP_KEYNAME_MAXLEN, "%s%s", ref->res_path, "state") >= ICMAP_KEYNAME_MAXLEN) ||
|
||||
+ (icmap_get_string(key_name, &state) != CS_OK)) {
|
||||
/* key does not exist.
|
||||
*/
|
||||
log_printf (LOGSYS_LEVEL_WARNING,
|
||||
--
|
||||
2.13.6
|
||||
|
@ -1,3 +1,9 @@
|
||||
-------------------------------------------------------------------
|
||||
Tue Dec 5 06:13:13 UTC 2017 - bliu@suse.com
|
||||
|
||||
- wd: gcc shows snprintf warnings(bsc#1071187)
|
||||
Added: 0008-wd-fix-snprintf-warnings.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Nov 23 13:48:33 UTC 2017 - rbrown@suse.com
|
||||
|
||||
|
@ -69,6 +69,7 @@ Patch11: 0004-mark-corosync-as-a-static-service.patch
|
||||
Patch12: 0005-do-not-convert-empty-uid-gid-to-0.patch
|
||||
Patch13: 0006-Fix-compile-warnings-with-GCC-7.2.1.patch
|
||||
Patch14: 0007-sync-Call-sync_init-of-all-services-at-once.patch
|
||||
Patch15: 0008-wd-fix-snprintf-warnings.patch
|
||||
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
# openais is indeed gone and should be uninstalled. Yes, we do not
|
||||
@ -148,6 +149,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
%patch12 -p1
|
||||
%patch13 -p1
|
||||
%patch14 -p1
|
||||
%patch15 -p1
|
||||
|
||||
%build
|
||||
%if %{with runautogen}
|
||||
|
Loading…
Reference in New Issue
Block a user