Accepting request 582536 from home:BinLiu:branches:network:ha-clustering:Factory

- some coverity fixes for corosync on upstream(bsc#1083895)
    Added: 0015-coverity-fixes.patch

OBS-URL: https://build.opensuse.org/request/show/582536
OBS-URL: https://build.opensuse.org/package/show/network:ha-clustering:Factory/corosync?expand=0&rev=135
This commit is contained in:
Bin Liu 2018-03-05 08:32:16 +00:00 committed by Git OBS Bridge
parent 868d6de717
commit 457957e6de
3 changed files with 1007 additions and 0 deletions

999
0015-coverity-fixes.patch Normal file
View File

@ -0,0 +1,999 @@
diff --git a/init/corosync-notifyd.in b/init/corosync-notifyd.in
index 0f34e791..d3575795 100755
--- a/init/corosync-notifyd.in
+++ b/init/corosync-notifyd.in
@@ -99,7 +99,7 @@ stop()
! status $prog > /dev/null 2>&1 && return
echo -n "Signaling $desc ($prog) to terminate: "
- kill -TERM $(pidof $prog) > /dev/null 2>&1
+ kill -TERM "$(pidof $prog)" > /dev/null 2>&1
success
echo
diff --git a/init/corosync-qdevice.in b/init/corosync-qdevice.in
index 8e4bb291..1cd32709 100755
--- a/init/corosync-qdevice.in
+++ b/init/corosync-qdevice.in
@@ -113,7 +113,7 @@ stop()
! status $prog > /dev/null 2>&1 && return
echo -n "Signaling $desc ($prog) to terminate: "
- kill -TERM $(pidof $prog) > /dev/null 2>&1
+ kill -TERM "$(pidof $prog)" > /dev/null 2>&1
success
echo
diff --git a/init/corosync-qnetd.in b/init/corosync-qnetd.in
index 681ea085..c06dbb97 100755
--- a/init/corosync-qnetd.in
+++ b/init/corosync-qnetd.in
@@ -120,7 +120,7 @@ stop()
! status $prog > /dev/null 2>&1 && return
echo -n "Signaling $desc ($prog) to terminate: "
- kill -TERM $(pidof $prog) > /dev/null 2>&1
+ kill -TERM "$(pidof $prog)" > /dev/null 2>&1
success
echo
diff --git a/init/corosync.in b/init/corosync.in
index 0868f116..fc3ce58c 100755
--- a/init/corosync.in
+++ b/init/corosync.in
@@ -128,7 +128,7 @@ stop()
! status $prog > /dev/null 2>&1 && return
echo -n "Signaling $desc ($prog) to terminate: "
- kill -TERM $(pidof $prog) > /dev/null 2>&1
+ kill -TERM "$(pidof $prog)" > /dev/null 2>&1
success
echo
diff --git a/tools/corosync-blackbox.sh b/tools/corosync-blackbox.sh
index fb5ce96f..1ca831f3 100644
--- a/tools/corosync-blackbox.sh
+++ b/tools/corosync-blackbox.sh
@@ -29,6 +29,6 @@
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
# THE POSSIBILITY OF SUCH DAMAGE.
-corosync-cmapctl -s runtime.blackbox.dump_state str $(date +%s)
-corosync-cmapctl -s runtime.blackbox.dump_flight_data str $(date +%s)
+corosync-cmapctl -s runtime.blackbox.dump_state str "$(date +%s)"
+corosync-cmapctl -s runtime.blackbox.dump_flight_data str "$(date +%s)"
qb-blackbox "@LOCALSTATEDIR@/lib/corosync/fdata"
diff --git a/qdevices/corosync-qdevice-net-certutil.sh b/qdevices/corosync-qdevice-net-certutil.sh
index 10b47c8a..b3286295 100644
--- a/qdevices/corosync-qdevice-net-certutil.sh
+++ b/qdevices/corosync-qdevice-net-certutil.sh
@@ -37,19 +37,13 @@
BASE_DIR="@COROSYSCONFDIR@/qdevice/net"
DB_DIR_QNETD="@COROSYSCONFDIR@/qnetd/nssdb"
DB_DIR_NODE="$BASE_DIR/nssdb"
-# Validity of certificate (months)
-CRT_VALIDITY=1200
CA_NICKNAME="QNet CA"
-SERVER_NICKNAME="QNetd Cert"
CLUSTER_NICKNAME="Cluster Cert"
-CA_SUBJECT="CN=QNet CA"
-SERVER_SUBJECT="CN=Qnetd Server"
PWD_FILE_BASE="pwdfile.txt"
NOISE_FILE_BASE="noise.txt"
SERIAL_NO_FILE_BASE="serial.txt"
CA_EXPORT_FILE="$DB_DIR_QNETD/qnetd-cacert.crt"
CRQ_FILE_BASE="qdevice-net-node.crq"
-CRT_FILE_BASE="" # Generated from cluster name
P12_FILE_BASE="qdevice-net-node.p12"
QNETD_CERTUTIL_CMD="corosync-qnetd-certutil"
@@ -309,7 +303,6 @@ PWD_FILE="$DB_DIR/$PWD_FILE_BASE"
NOISE_FILE="$DB_DIR/$NOISE_FILE_BASE"
SERIAL_NO_FILE="$DB_DIR/$SERIAL_NO_FILE_BASE"
CRQ_FILE="$DB_DIR/$CRQ_FILE_BASE"
-CRT_FILE="$DB_DIR/cluster-$CLUSTER_NAME.crt"
P12_FILE="$DB_DIR/$P12_FILE_BASE"
case "$OPERATION" in
diff --git a/qdevices/corosync-qnetd-certutil.sh b/qdevices/corosync-qnetd-certutil.sh
index 726f482f..fa1d229d 100644
--- a/qdevices/corosync-qnetd-certutil.sh
+++ b/qdevices/corosync-qnetd-certutil.sh
@@ -40,14 +40,12 @@ DB_DIR="$CONFIG_DIR/nssdb"
CRT_VALIDITY=1200
CA_NICKNAME="QNet CA"
SERVER_NICKNAME="QNetd Cert"
-CLUSTER_NICKNAME="Cluster Cert"
CA_SUBJECT="CN=QNet CA"
SERVER_SUBJECT="CN=Qnetd Server"
PWD_FILE="$DB_DIR/pwdfile.txt"
NOISE_FILE="$DB_DIR/noise.txt"
SERIAL_NO_FILE="$DB_DIR/serial.txt"
CA_EXPORT_FILE="$DB_DIR/qnetd-cacert.crt"
-CRT_FILE_BASE="" # Generated from cluster name
usage() {
echo "$0: [-i|-s] [-c certificate] [-n cluster_name]"
@@ -62,7 +60,7 @@ usage() {
chown_ref_cfgdir() {
if [ "$UID" == "0" ];then
- chown --reference="$CONFIG_DIR" "$@" 2>/dev/null || chown `stat -f "%u:%g" "$CONFIG_DIR"` "$@" 2>/dev/null || return $?
+ chown --reference="$CONFIG_DIR" "$@" 2>/dev/null || chown "$(stat -f "%u:%g" "$CONFIG_DIR")" "$@" 2>/dev/null || return $?
fi
}
@@ -123,14 +121,14 @@ init_qnetd_ca() {
echo "Creating new CA"
# Create self-signed certificate (CA). Asks 3 questions (is this CA, lifetime and critical extension
echo -e "y\n0\ny\n" | certutil -S -n "$CA_NICKNAME" -s "$CA_SUBJECT" -x \
- -t "CT,," -m `get_serial_no` -v $CRT_VALIDITY -d "$DB_DIR" \
+ -t "CT,," -m "$(get_serial_no)" -v $CRT_VALIDITY -d "$DB_DIR" \
-z "$NOISE_FILE" -f "$PWD_FILE" -2
# Export CA certificate in ascii
certutil -L -d "$DB_DIR" -n "$CA_NICKNAME" > "$CA_EXPORT_FILE"
certutil -L -d "$DB_DIR" -n "$CA_NICKNAME" -a >> "$CA_EXPORT_FILE"
chown_ref_cfgdir "$CA_EXPORT_FILE"
- certutil -S -n "$SERVER_NICKNAME" -s "$SERVER_SUBJECT" -c "$CA_NICKNAME" -t "u,u,u" -m `get_serial_no` \
+ certutil -S -n "$SERVER_NICKNAME" -s "$SERVER_SUBJECT" -c "$CA_NICKNAME" -t "u,u,u" -m "$(get_serial_no)" \
-v $CRT_VALIDITY -d "$DB_DIR" -z "$NOISE_FILE" -f "$PWD_FILE"
echo "QNetd CA certificate is exported as $CA_EXPORT_FILE"
@@ -145,7 +143,7 @@ sign_cluster_cert() {
fi
echo "Signing cluster certificate"
- certutil -C -v "$CRT_VALIDITY" -m `get_serial_no` -i "$CERTIFICATE_FILE" -o "$CRT_FILE" -c "$CA_NICKNAME" -d "$DB_DIR"
+ certutil -C -v "$CRT_VALIDITY" -m "$(get_serial_no)" -i "$CERTIFICATE_FILE" -o "$CRT_FILE" -c "$CA_NICKNAME" -d "$DB_DIR"
chown_ref_cfgdir "$CRT_FILE"
echo "Certificate stored in $CRT_FILE"
diff --git a/cts/agents/sam_test_agent.c b/cts/agents/sam_test_agent.c
index c395db28..39d406c3 100644
--- a/cts/agents/sam_test_agent.c
+++ b/cts/agents/sam_test_agent.c
@@ -1220,7 +1220,6 @@ static void do_command (int sock, char* func, char*args[], int num_args)
} else if (strcmp ("sam_stop", func) == 0) {
err = sam_stop ();
if (err != CS_OK) {
- err = -1;
qb_log (LOG_ERR,"RPC:%s sam_stop failed!", func);
snprintf (response, 100, "%s", FAIL_STR);
}
diff --git a/qdevices/process-list.c b/qdevices/process-list.c
index ad2d598b..e5c20db4 100644
--- a/qdevices/process-list.c
+++ b/qdevices/process-list.c
@@ -161,6 +161,7 @@ process_list_parse_command(const char *command, size_t *no_params)
if (res_argv[zi] == NULL) {
process_list_free_argv(*no_params, res_argv);
res_argv = NULL;
+ goto exit_res;
}
zi++;
}
diff --git a/tools/corosync-quorumtool.c b/tools/corosync-quorumtool.c
index b37e67f7..2ea006b5 100644
--- a/tools/corosync-quorumtool.c
+++ b/tools/corosync-quorumtool.c
@@ -532,7 +532,9 @@ static void display_nodes_data(nodeid_format_t nodeid_format, name_format_t name
printf("%s", g_view_list[i].name);
if (g_view_list[i].node_id == our_nodeid) {
printf(" (local)");
- our_flags = info[i].flags;
+ if (v_handle) {
+ our_flags = info[i].flags;
+ }
}
printf("\n");
}
diff --git a/qdevices/corosync-qdevice-net-certutil.sh b/qdevices/corosync-qdevice-net-certutil.sh
index b3286295..22bc899a 100644
--- a/qdevices/corosync-qdevice-net-certutil.sh
+++ b/qdevices/corosync-qdevice-net-certutil.sh
@@ -369,7 +369,7 @@ case "$OPERATION" in
master_node="$1"
shift 1
- other_nodes="$@"
+ other_nodes="$*"
if [ "$CLUSTER_NAME" == "" ];then
echo "You have to specify cluster name" >&2
diff --git a/qdevices/qnetd-ipc.c b/qdevices/qnetd-ipc.c
index 0d40275e..e5228373 100644
--- a/qdevices/qnetd-ipc.c
+++ b/qdevices/qnetd-ipc.c
@@ -174,7 +174,8 @@ void
qnetd_ipc_client_disconnect(struct qnetd_instance *instance, struct unix_socket_client *client)
{
- if (PR_DestroySocketPollFd(
+ if ((struct qnetd_ipc_user_data *)(client)->user_data != NULL &&
+ PR_DestroySocketPollFd(
((struct qnetd_ipc_user_data *)(client)->user_data)->nspr_poll_fd) != PR_SUCCESS) {
qnetd_log_nss(LOG_WARNING, "Unable to destroy client IPC poll socket fd");
}
diff --git a/qdevices/Makefile.am b/qdevices/Makefile.am
index 0ab73464..28388a93 100644
--- a/qdevices/Makefile.am
+++ b/qdevices/Makefile.am
@@ -156,9 +156,9 @@ corosync-qdevice-net-certutil: corosync-qdevice-net-certutil.sh
$< > $@
TESTS = qnetd-cluster-list.test dynar.test dynar-simple-lex.test \
- dynar-getopt-lex.test process-list.test
+ dynar-getopt-lex.test process-list.test utils.test
check_PROGRAMS = qnetd-cluster-list.test dynar.test dynar-simple-lex.test \
- dynar-getopt-lex.test process-list.test
+ dynar-getopt-lex.test process-list.test utils.test
qnetd_cluster_list_test_SOURCES = qnetd-cluster-list.c test-qnetd-cluster-list.c \
qnetd-cluster.c qnetd-cluster.h \
@@ -172,5 +172,6 @@ dynar_simple_lex_test_SOURCES = test-dynar-simple-lex.c dynar.c dynar-str.c dyna
dynar_getopt_lex_test_SOURCES = test-dynar-getopt-lex.c dynar.c dynar-str.c dynar-getopt-lex.c
process_list_test_SOURCES = test-process-list.c dynar.c dynar-str.c dynar-simple-lex.c \
process-list.c
+utils_test_SOURCES = test-utils.c utils.c
endif
diff --git a/qdevices/test-utils.c b/qdevices/test-utils.c
new file mode 100644
index 00000000..00d5b464
--- /dev/null
+++ b/qdevices/test-utils.c
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2015-2018 Red Hat, Inc.
+ *
+ * All rights reserved.
+ *
+ * Author: Jan Friesse (jfriesse@redhat.com)
+ *
+ * This software licensed under BSD license, the text of which follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * - Neither the name of the Red Hat, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <stdio.h>
+#include <assert.h>
+#include <string.h>
+#include <errno.h>
+
+#include "utils.h"
+
+int
+main(void)
+{
+ long long int ll;
+ long long int lli;
+ char buf[32];
+
+ assert(utils_strtonum("0", 0, 100, &ll) == 0);
+ assert(ll == 0);
+
+ assert(utils_strtonum("100", 0, 100, &ll) == 0);
+ assert(ll == 100);
+
+ assert(utils_strtonum("101", 0, 100, &ll) != 0);
+ assert(utils_strtonum("0", 1, 100, &ll) != 0);
+
+ errno = ERANGE;
+ assert(utils_strtonum("10", 0, 100, &ll) == 0);
+ assert(ll == 10);
+
+ assert(utils_strtonum("-1", -1, 0, &ll) == 0);
+ assert(ll == -1);
+
+ assert(utils_strtonum("-10", -20, -10, &ll) == 0);
+ assert(ll == -10);
+
+ assert(utils_strtonum("0", 1, 0, &ll) == -1);
+
+ for (lli = -100; lli <= 100; lli++) {
+ assert(snprintf(buf, sizeof(buf), "%lld", lli) > 0);
+
+ assert(utils_strtonum(buf, -100, 100, &ll) == 0);
+ assert(ll == lli);
+ }
+
+ assert(utils_strtonum("test", -1000, 1000, &ll) == -1);
+ assert(utils_strtonum("12a", -1000, 1000, &ll) == -1);
+
+ return (0);
+}
diff --git a/qdevices/utils.c b/qdevices/utils.c
index 9574c96a..aba921c3 100644
--- a/qdevices/utils.c
+++ b/qdevices/utils.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015-2016 Red Hat, Inc.
+ * Copyright (c) 2015-2018 Red Hat, Inc.
*
* All rights reserved.
*
@@ -206,3 +206,33 @@ utils_fd_set_non_blocking(int fd)
return (0);
}
+
+/*
+ * Safer wrapper of strtoll. Return 0 on success, otherwise -1.
+ */
+int
+utils_strtonum(const char *str, long long int min_val, long long int max_val,
+ long long int *res)
+{
+ long long int tmp_ll;
+ char *ep;
+
+ if (min_val > max_val) {
+ return (-1);
+ }
+
+ errno = 0;
+
+ tmp_ll = strtoll(str, &ep, 10);
+ if (ep == str || *ep != '\0' || errno != 0) {
+ return (-1);
+ }
+
+ if (tmp_ll < min_val || tmp_ll > max_val) {
+ return (-1);
+ }
+
+ *res = tmp_ll;
+
+ return (0);
+}
diff --git a/qdevices/utils.h b/qdevices/utils.h
index fe9b5b47..0d96df43 100644
--- a/qdevices/utils.h
+++ b/qdevices/utils.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015-2016 Red Hat, Inc.
+ * Copyright (c) 2015-2018 Red Hat, Inc.
*
* All rights reserved.
*
@@ -62,6 +62,9 @@ extern void utils_tty_detach(void);
extern int utils_fd_set_non_blocking(int fd);
+extern int utils_strtonum(const char *str, long long int min_val,
+ long long int max_val, long long int *res);
+
#ifdef __cplusplus
}
#endif
diff --git a/qdevices/qdevice-advanced-settings.c b/qdevices/qdevice-advanced-settings.c
index e3d7a9a9..41df6ca5 100644
--- a/qdevices/qdevice-advanced-settings.c
+++ b/qdevices/qdevice-advanced-settings.c
@@ -33,8 +33,10 @@
*/
#include <stdlib.h>
-#include <string.h>
+
#include <errno.h>
+#include <limits.h>
+#include <string.h>
#include "dynar.h"
#include "dynar-getopt-lex.h"
@@ -126,7 +128,6 @@ qdevice_advanced_settings_set(struct qdevice_advanced_settings *settings,
const char *option, const char *value)
{
long long int tmpll;
- char *ep;
if (strcasecmp(option, "lock_file") == 0) {
free(settings->lock_file);
@@ -141,15 +142,13 @@ qdevice_advanced_settings_set(struct qdevice_advanced_settings *settings,
return (-1);
}
} else if (strcasecmp(option, "local_socket_backlog") == 0) {
- tmpll = strtoll(value, &ep, 10);
- if (tmpll < QDEVICE_MIN_LOCAL_SOCKET_BACKLOG || errno != 0 || *ep != '\0') {
+ if (utils_strtonum(value, QDEVICE_MIN_LOCAL_SOCKET_BACKLOG, INT_MAX, &tmpll) == -1) {
return (-2);
}
settings->local_socket_backlog = (int)tmpll;
} else if (strcasecmp(option, "max_cs_try_again") == 0) {
- tmpll = strtoll(value, &ep, 10);
- if (tmpll < QDEVICE_MIN_MAX_CS_TRY_AGAIN || errno != 0 || *ep != '\0') {
+ if (utils_strtonum(value, QDEVICE_MIN_MAX_CS_TRY_AGAIN, INT_MAX, &tmpll) == -1) {
return (-2);
}
@@ -161,71 +160,70 @@ qdevice_advanced_settings_set(struct qdevice_advanced_settings *settings,
return (-1);
}
} else if (strcasecmp(option, "ipc_max_clients") == 0) {
- tmpll = strtoll(value, &ep, 10);
- if (tmpll < QDEVICE_MIN_IPC_MAX_CLIENTS || errno != 0 || *ep != '\0') {
+ if (utils_strtonum(value, QDEVICE_MIN_IPC_MAX_CLIENTS, LLONG_MAX, &tmpll) == -1) {
return (-2);
}
settings->ipc_max_clients = (size_t)tmpll;
} else if (strcasecmp(option, "ipc_max_receive_size") == 0) {
- tmpll = strtoll(value, &ep, 10);
- if (tmpll < QDEVICE_MIN_IPC_RECEIVE_SEND_SIZE || errno != 0 || *ep != '\0') {
+ if (utils_strtonum(value, QDEVICE_MIN_IPC_RECEIVE_SEND_SIZE, LLONG_MAX,
+ &tmpll) == -1) {
return (-2);
}
settings->ipc_max_receive_size = (size_t)tmpll;
} else if (strcasecmp(option, "ipc_max_send_size") == 0) {
- tmpll = strtoll(value, &ep, 10);
- if (tmpll < QDEVICE_MIN_IPC_RECEIVE_SEND_SIZE || errno != 0 || *ep != '\0') {
+ if (utils_strtonum(value, QDEVICE_MIN_IPC_RECEIVE_SEND_SIZE, LLONG_MAX,
+ &tmpll) == -1) {
return (-2);
}
settings->ipc_max_send_size = (size_t)tmpll;
} else if (strcasecmp(option, "heuristics_ipc_max_send_buffers") == 0) {
- tmpll = strtoll(value, &ep, 10);
- if (tmpll < QDEVICE_MIN_HEURISTICS_IPC_MAX_SEND_BUFFERS || errno != 0 || *ep != '\0') {
+ if (utils_strtonum(value, QDEVICE_MIN_HEURISTICS_IPC_MAX_SEND_BUFFERS, LLONG_MAX,
+ &tmpll) == -1) {
return (-2);
}
settings->heuristics_ipc_max_send_buffers = (size_t)tmpll;
} else if (strcasecmp(option, "heuristics_ipc_max_send_receive_size") == 0) {
- tmpll = strtoll(value, &ep, 10);
- if (tmpll < QDEVICE_MIN_HEURISTICS_IPC_MAX_SEND_RECEIVE_SIZE || errno != 0 || *ep != '\0') {
+ if (utils_strtonum(value, QDEVICE_MIN_HEURISTICS_IPC_MAX_SEND_RECEIVE_SIZE, LLONG_MAX,
+ &tmpll) == -1) {
return (-2);
}
settings->heuristics_ipc_max_send_receive_size = (size_t)tmpll;
} else if (strcasecmp(option, "heuristics_min_timeout") == 0) {
- tmpll = strtoll(value, &ep, 10);
- if (tmpll < QDEVICE_MIN_HEURISTICS_TIMEOUT || errno != 0 || *ep != '\0') {
+ if (utils_strtonum(value, QDEVICE_MIN_HEURISTICS_TIMEOUT, UINT32_MAX,
+ &tmpll) == -1) {
return (-2);
}
settings->heuristics_min_timeout = (uint32_t)tmpll;
} else if (strcasecmp(option, "heuristics_max_timeout") == 0) {
- tmpll = strtoll(value, &ep, 10);
- if (tmpll < QDEVICE_MIN_HEURISTICS_TIMEOUT || errno != 0 || *ep != '\0') {
+ if (utils_strtonum(value, QDEVICE_MIN_HEURISTICS_TIMEOUT, UINT32_MAX,
+ &tmpll) == -1) {
return (-2);
}
settings->heuristics_max_timeout = (uint32_t)tmpll;
} else if (strcasecmp(option, "heuristics_min_interval") == 0) {
- tmpll = strtoll(value, &ep, 10);
- if (tmpll < QDEVICE_MIN_HEURISTICS_INTERVAL || errno != 0 || *ep != '\0') {
+ if (utils_strtonum(value, QDEVICE_MIN_HEURISTICS_INTERVAL, UINT32_MAX,
+ &tmpll) == -1) {
return (-2);
}
settings->heuristics_min_interval = (uint32_t)tmpll;
} else if (strcasecmp(option, "heuristics_max_interval") == 0) {
- tmpll = strtoll(value, &ep, 10);
- if (tmpll < QDEVICE_MIN_HEURISTICS_INTERVAL || errno != 0 || *ep != '\0') {
+ if (utils_strtonum(value, QDEVICE_MIN_HEURISTICS_INTERVAL, UINT32_MAX,
+ &tmpll) == -1) {
return (-2);
}
settings->heuristics_max_interval = (uint32_t)tmpll;
} else if (strcasecmp(option, "heuristics_max_execs") == 0) {
- tmpll = strtoll(value, &ep, 10);
- if (tmpll < QDEVICE_MIN_HEURISTICS_MAX_EXECS || errno != 0 || *ep != '\0') {
+ if (utils_strtonum(value, QDEVICE_MIN_HEURISTICS_MAX_EXECS, LLONG_MAX,
+ &tmpll) == -1) {
return (-2);
}
@@ -237,15 +235,15 @@ qdevice_advanced_settings_set(struct qdevice_advanced_settings *settings,
settings->heuristics_use_execvp = (uint8_t)tmpll;
} else if (strcasecmp(option, "heuristics_max_processes") == 0) {
- tmpll = strtoll(value, &ep, 10);
- if (tmpll < QDEVICE_MIN_HEURISTICS_MAX_PROCESSES || errno != 0 || *ep != '\0') {
+ if (utils_strtonum(value, QDEVICE_MIN_HEURISTICS_MAX_PROCESSES, LLONG_MAX,
+ &tmpll) == -1) {
return (-2);
}
settings->heuristics_max_processes = (size_t)tmpll;
} else if (strcasecmp(option, "heuristics_kill_list_interval") == 0) {
- tmpll = strtoll(value, &ep, 10);
- if (tmpll < QDEVICE_MIN_HEURISTICS_KILL_LIST_INTERVAL || errno != 0 || *ep != '\0') {
+ if (utils_strtonum(value, QDEVICE_MIN_HEURISTICS_KILL_LIST_INTERVAL, UINT32_MAX,
+ &tmpll) == -1) {
return (-2);
}
@@ -257,36 +255,36 @@ qdevice_advanced_settings_set(struct qdevice_advanced_settings *settings,
return (-1);
}
} else if (strcasecmp(option, "net_initial_msg_receive_size") == 0) {
- tmpll = strtoll(value, &ep, 10);
- if (tmpll < QDEVICE_NET_MIN_MSG_RECEIVE_SEND_SIZE || errno != 0 || *ep != '\0') {
+ if (utils_strtonum(value, QDEVICE_NET_MIN_MSG_RECEIVE_SEND_SIZE, LLONG_MAX,
+ &tmpll) == -1) {
return (-2);
}
settings->net_initial_msg_receive_size = (size_t)tmpll;
} else if (strcasecmp(option, "net_initial_msg_send_size") == 0) {
- tmpll = strtoll(value, &ep, 10);
- if (tmpll < QDEVICE_NET_MIN_MSG_RECEIVE_SEND_SIZE || errno != 0 || *ep != '\0') {
+ if (utils_strtonum(value, QDEVICE_NET_MIN_MSG_RECEIVE_SEND_SIZE, LLONG_MAX,
+ &tmpll) == -1) {
return (-2);
}
settings->net_initial_msg_send_size = (size_t)tmpll;
} else if (strcasecmp(option, "net_min_msg_send_size") == 0) {
- tmpll = strtoll(value, &ep, 10);
- if (tmpll < QDEVICE_NET_MIN_MSG_RECEIVE_SEND_SIZE || errno != 0 || *ep != '\0') {
+ if (utils_strtonum(value, QDEVICE_NET_MIN_MSG_RECEIVE_SEND_SIZE, LLONG_MAX,
+ &tmpll) == -1) {
return (-2);
}
settings->net_min_msg_send_size = (size_t)tmpll;
} else if (strcasecmp(option, "net_max_msg_receive_size") == 0) {
- tmpll = strtoll(value, &ep, 10);
- if (tmpll < QDEVICE_NET_MIN_MSG_RECEIVE_SEND_SIZE || errno != 0 || *ep != '\0') {
+ if (utils_strtonum(value, QDEVICE_NET_MIN_MSG_RECEIVE_SEND_SIZE, LLONG_MAX,
+ &tmpll) == -1) {
return (-2);
}
settings->net_max_msg_receive_size = (size_t)tmpll;
} else if (strcasecmp(option, "net_max_send_buffers") == 0) {
- tmpll = strtoll(value, &ep, 10);
- if (tmpll < QDEVICE_NET_MIN_MAX_SEND_BUFFERS || errno != 0 || *ep != '\0') {
+ if (utils_strtonum(value, QDEVICE_NET_MIN_MAX_SEND_BUFFERS, LLONG_MAX,
+ &tmpll) == -1) {
return (-2);
}
@@ -304,29 +302,29 @@ qdevice_advanced_settings_set(struct qdevice_advanced_settings *settings,
return (-1);
}
} else if (strcasecmp(option, "net_heartbeat_interval_min") == 0) {
- tmpll = strtoll(value, &ep, 10);
- if (tmpll < QDEVICE_NET_MIN_HEARTBEAT_INTERVAL || errno != 0 || *ep != '\0') {
+ if (utils_strtonum(value, QDEVICE_NET_MIN_HEARTBEAT_INTERVAL, UINT32_MAX,
+ &tmpll) == -1) {
return (-2);
}
settings->net_heartbeat_interval_min = (uint32_t)tmpll;
} else if (strcasecmp(option, "net_heartbeat_interval_max") == 0) {
- tmpll = strtoll(value, &ep, 10);
- if (tmpll < QDEVICE_NET_MIN_HEARTBEAT_INTERVAL || errno != 0 || *ep != '\0') {
+ if (utils_strtonum(value, QDEVICE_NET_MIN_HEARTBEAT_INTERVAL, UINT32_MAX,
+ &tmpll) == -1) {
return (-2);
}
settings->net_heartbeat_interval_max = (uint32_t)tmpll;
} else if (strcasecmp(option, "net_min_connect_timeout") == 0) {
- tmpll = strtoll(value, &ep, 10);
- if (tmpll < QDEVICE_NET_MIN_CONNECT_TIMEOUT || errno != 0 || *ep != '\0') {
+ if (utils_strtonum(value, QDEVICE_NET_MIN_CONNECT_TIMEOUT, UINT32_MAX,
+ &tmpll) == -1) {
return (-2);
}
settings->net_min_connect_timeout = (uint32_t)tmpll;
} else if (strcasecmp(option, "net_max_connect_timeout") == 0) {
- tmpll = strtoll(value, &ep, 10);
- if (tmpll < QDEVICE_NET_MIN_CONNECT_TIMEOUT || errno != 0 || *ep != '\0') {
+ if (utils_strtonum(value, QDEVICE_NET_MIN_CONNECT_TIMEOUT, UINT32_MAX,
+ &tmpll) == -1) {
return (-2);
}
diff --git a/qdevices/qdevice-instance.c b/qdevices/qdevice-instance.c
index 52593281..dd49b585 100644
--- a/qdevices/qdevice-instance.c
+++ b/qdevices/qdevice-instance.c
@@ -67,8 +67,7 @@ int
qdevice_instance_configure_from_cmap_heuristics(struct qdevice_instance *instance)
{
char *str;
- long int li;
- char *ep;
+ long long int lli;
int i;
int res;
cs_error_t cs_err;
@@ -87,9 +86,8 @@ qdevice_instance_configure_from_cmap_heuristics(struct qdevice_instance *instanc
instance->heuristics_instance.timeout = instance->heartbeat_interval / 2;
if (cmap_get_string(instance->cmap_handle,
"quorum.device.heuristics.timeout", &str) == CS_OK) {
- li = strtol(str, &ep, 10);
- if (li < instance->advanced_settings->heuristics_min_timeout ||
- li > instance->advanced_settings->heuristics_max_timeout || *ep != '\0') {
+ if (utils_strtonum(str, instance->advanced_settings->heuristics_min_timeout,
+ instance->advanced_settings->heuristics_max_timeout, &lli) == -1) {
qdevice_log(LOG_ERR, "heuristics.timeout must be valid number in "
"range <%"PRIu32",%"PRIu32">",
instance->advanced_settings->heuristics_min_timeout,
@@ -98,7 +96,7 @@ qdevice_instance_configure_from_cmap_heuristics(struct qdevice_instance *instanc
free(str);
return (-1);
} else {
- instance->heuristics_instance.timeout = li;
+ instance->heuristics_instance.timeout = lli;
}
free(str);
@@ -107,9 +105,8 @@ qdevice_instance_configure_from_cmap_heuristics(struct qdevice_instance *instanc
instance->heuristics_instance.sync_timeout = instance->sync_heartbeat_interval / 2;
if (cmap_get_string(instance->cmap_handle,
"quorum.device.heuristics.sync_timeout", &str) == CS_OK) {
- li = strtol(str, &ep, 10);
- if (li < instance->advanced_settings->heuristics_min_timeout ||
- li > instance->advanced_settings->heuristics_max_timeout || *ep != '\0') {
+ if (utils_strtonum(str, instance->advanced_settings->heuristics_min_timeout,
+ instance->advanced_settings->heuristics_max_timeout, &lli) == -1) {
qdevice_log(LOG_ERR, "heuristics.sync_timeout must be valid number in "
"range <%"PRIu32",%"PRIu32">",
instance->advanced_settings->heuristics_min_timeout,
@@ -118,7 +115,7 @@ qdevice_instance_configure_from_cmap_heuristics(struct qdevice_instance *instanc
free(str);
return (-1);
} else {
- instance->heuristics_instance.sync_timeout = li;
+ instance->heuristics_instance.sync_timeout = lli;
}
free(str);
@@ -127,9 +124,8 @@ qdevice_instance_configure_from_cmap_heuristics(struct qdevice_instance *instanc
instance->heuristics_instance.interval = instance->heartbeat_interval * 3;
if (cmap_get_string(instance->cmap_handle,
"quorum.device.heuristics.interval", &str) == CS_OK) {
- li = strtol(str, &ep, 10);
- if (li < instance->advanced_settings->heuristics_min_interval ||
- li > instance->advanced_settings->heuristics_max_interval || *ep != '\0') {
+ if (utils_strtonum(str, instance->advanced_settings->heuristics_min_interval,
+ instance->advanced_settings->heuristics_max_interval, &lli) == -1) {
qdevice_log(LOG_ERR, "heuristics.interval must be valid number in "
"range <%"PRIu32",%"PRIu32">",
instance->advanced_settings->heuristics_min_interval,
@@ -138,7 +134,7 @@ qdevice_instance_configure_from_cmap_heuristics(struct qdevice_instance *instanc
free(str);
return (-1);
} else {
- instance->heuristics_instance.interval = li;
+ instance->heuristics_instance.interval = lli;
}
free(str);
diff --git a/qdevices/qdevice-net-instance.c b/qdevices/qdevice-net-instance.c
index e4b7b04d..87cf3ee0 100644
--- a/qdevices/qdevice-net-instance.c
+++ b/qdevices/qdevice-net-instance.c
@@ -32,6 +32,8 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include <limits.h>
+
#include "qdevice-config.h"
#include "qdevice-log.h"
#include "qdevice-net-instance.h"
@@ -214,7 +216,7 @@ qdevice_net_instance_init_from_cmap(struct qdevice_instance *instance)
cmap_handle_t cmap_handle;
enum tlv_tls_supported tls_supported;
int i;
- long int li;
+ long long int lli;
enum tlv_decision_algorithm_type decision_algorithm;
struct tlv_tie_breaker tie_breaker;
uint32_t heartbeat_interval;
@@ -222,7 +224,6 @@ qdevice_net_instance_init_from_cmap(struct qdevice_instance *instance)
uint32_t cast_vote_timer_interval;
char *host_addr;
int host_port;
- char *ep;
char *cluster_name;
uint32_t connect_timeout;
struct qdevice_net_instance *net_instance;
@@ -272,14 +273,14 @@ qdevice_net_instance_init_from_cmap(struct qdevice_instance *instance)
host_addr = str;
if (cmap_get_string(cmap_handle, "quorum.device.net.port", &str) == CS_OK) {
- host_port = strtol(str, &ep, 10);
-
- if (host_port <= 0 || host_port > ((uint16_t)~0) || *ep != '\0') {
- qdevice_log(LOG_ERR, "quorum.device.net.port must be in range 0-65535");
+ if (utils_strtonum(optarg, 1, UINT16_MAX, &lli) == -1) {
+ qdevice_log(LOG_ERR, "quorum.device.net.port must be in range 1-%u", UINT16_MAX);
free(str);
goto error_free_host_addr;
}
free(str);
+
+ host_port = lli;
} else {
host_port = QNETD_DEFAULT_HOST_PORT;
}
@@ -353,15 +354,14 @@ qdevice_net_instance_init_from_cmap(struct qdevice_instance *instance)
} else if (strcmp(str, "highest") == 0) {
tie_breaker.mode = TLV_TIE_BREAKER_MODE_HIGHEST;
} else {
- li = strtol(str, &ep, 10);
- if (li <= 0 || li > ((uint32_t)~0) || *ep != '\0') {
+ if (utils_strtonum(str, 1, UINT32_MAX, &lli) == -1) {
qdevice_log(LOG_ERR, "tie_breaker must be lowest|highest|valid_node_id");
free(str);
goto error_free_cluster_name;
}
tie_breaker.mode = TLV_TIE_BREAKER_MODE_NODE_ID;
- tie_breaker.node_id = li;
+ tie_breaker.node_id = lli;
}
free(str);
@@ -373,9 +373,8 @@ qdevice_net_instance_init_from_cmap(struct qdevice_instance *instance)
if (cmap_get_string(cmap_handle, "quorum.device.net.connect_timeout", &str) != CS_OK) {
connect_timeout = heartbeat_interval;
} else {
- li = strtol(str, &ep, 10);
- if (li < instance->advanced_settings->net_min_connect_timeout ||
- li > instance->advanced_settings->net_max_connect_timeout || *ep != '\0') {
+ if (utils_strtonum(str, instance->advanced_settings->net_min_connect_timeout,
+ instance->advanced_settings->net_max_connect_timeout, &lli) == -1) {
qdevice_log(LOG_ERR, "connect_timeout must be valid number in "
"range <%"PRIu32",%"PRIu32">",
instance->advanced_settings->net_min_connect_timeout,
@@ -384,7 +383,7 @@ qdevice_net_instance_init_from_cmap(struct qdevice_instance *instance)
goto error_free_cluster_name;
}
- connect_timeout = li;
+ connect_timeout = (uint32_t)lli;
free(str);
}
@@ -392,14 +391,14 @@ qdevice_net_instance_init_from_cmap(struct qdevice_instance *instance)
if (cmap_get_string(cmap_handle, "quorum.device.net.force_ip_version", &str) != CS_OK) {
force_ip_version = 0;
} else {
- li = strtol(str, &ep, 10);
- if ((li != 0 && li != 4 && li != 6) || *ep != '\0') {
+ if ((utils_strtonum(str, 0, 6, &lli) == -1) ||
+ (lli != 0 && lli != 4 && lli != 6)) {
qdevice_log(LOG_ERR, "force_ip_version must be one of 0|4|6");
free(str);
goto error_free_cluster_name;
}
- force_ip_version = li;
+ force_ip_version = lli;
free(str);
}
diff --git a/qdevices/corosync-qnetd.c b/qdevices/corosync-qnetd.c
index c6b8b0dc..9af94b7b 100644
--- a/qdevices/corosync-qnetd.c
+++ b/qdevices/corosync-qnetd.c
@@ -35,6 +35,7 @@
#include <err.h>
#include <errno.h>
#include <getopt.h>
+#include <limits.h>
#include <signal.h>
#include <unistd.h>
@@ -426,7 +427,6 @@ cli_parse(int argc, char * const argv[], char **host_addr, uint16_t *host_port,
struct qnetd_advanced_settings *advanced_settings)
{
int ch;
- char *ep;
long long int tmpll;
*host_addr = NULL;
@@ -469,19 +469,18 @@ cli_parse(int argc, char * const argv[], char **host_addr, uint16_t *host_port,
}
break;
case 'm':
- errno = 0;
-
- tmpll = strtoll(optarg, &ep, 10);
- if (tmpll < 0 || errno != 0 || *ep != '\0') {
+ if (utils_strtonum(optarg, 0, LLONG_MAX, &tmpll) == -1) {
errx(1, "max clients value %s is invalid", optarg);
}
+
*max_clients = (size_t)tmpll;
break;
case 'p':
- *host_port = strtol(optarg, &ep, 10);
- if (*host_port <= 0 || *host_port > ((uint16_t)~0) || *ep != '\0') {
- errx(1, "host port must be in range 0-65535");
+ if (utils_strtonum(optarg, 1, UINT16_MAX, &tmpll) == -1) {
+ errx(1, "host port must be in range 1-%u", UINT16_MAX);
}
+
+ *host_port = tmpll;
break;
case 'S':
cli_parse_long_opt(advanced_settings, optarg);
diff --git a/qdevices/qnetd-advanced-settings.c b/qdevices/qnetd-advanced-settings.c
index f1eff374..04519f0a 100644
--- a/qdevices/qnetd-advanced-settings.c
+++ b/qdevices/qnetd-advanced-settings.c
@@ -33,8 +33,10 @@
*/
#include <stdlib.h>
-#include <string.h>
+
#include <errno.h>
+#include <limits.h>
+#include <string.h>
#include "dynar.h"
#include "dynar-getopt-lex.h"
@@ -96,32 +98,27 @@ qnetd_advanced_settings_set(struct qnetd_advanced_settings *settings,
const char *option, const char *value)
{
long long int tmpll;
- char *ep;
if (strcasecmp(option, "listen_backlog") == 0) {
- tmpll = strtoll(value, &ep, 10);
- if (tmpll < QNETD_MIN_LISTEN_BACKLOG || errno != 0 || *ep != '\0') {
+ if (utils_strtonum(value, QNETD_MIN_LISTEN_BACKLOG, INT_MAX, &tmpll) == -1) {
return (-2);
}
settings->listen_backlog = (int)tmpll;
} else if (strcasecmp(option, "max_client_send_buffers") == 0) {
- tmpll = strtoll(value, &ep, 10);
- if (tmpll < QNETD_MIN_CLIENT_SEND_BUFFERS || errno != 0 || *ep != '\0') {
+ if (utils_strtonum(value, QNETD_MIN_CLIENT_SEND_BUFFERS, LLONG_MAX, &tmpll) == -1) {
return (-2);
}
settings->max_client_send_buffers = (size_t)tmpll;
} else if (strcasecmp(option, "max_client_send_size") == 0) {
- tmpll = strtoll(value, &ep, 10);
- if (tmpll < QNETD_MIN_CLIENT_RECEIVE_SEND_SIZE || errno != 0 || *ep != '\0') {
+ if (utils_strtonum(value, QNETD_MIN_CLIENT_RECEIVE_SEND_SIZE, LLONG_MAX, &tmpll) == -1) {
return (-2);
}
settings->max_client_send_size = (size_t)tmpll;
} else if (strcasecmp(option, "max_client_receive_size") == 0) {
- tmpll = strtoll(value, &ep, 10);
- if (tmpll < QNETD_MIN_CLIENT_RECEIVE_SEND_SIZE || errno != 0 || *ep != '\0') {
+ if (utils_strtonum(value, QNETD_MIN_CLIENT_RECEIVE_SEND_SIZE, LLONG_MAX, &tmpll) == -1) {
return (-2);
}
@@ -139,15 +136,13 @@ qnetd_advanced_settings_set(struct qnetd_advanced_settings *settings,
return (-1);
}
} else if (strcasecmp(option, "heartbeat_interval_min") == 0) {
- tmpll = strtoll(value, &ep, 10);
- if (tmpll < QNETD_MIN_HEARTBEAT_INTERVAL || errno != 0 || *ep != '\0') {
+ if (utils_strtonum(value, QNETD_MIN_HEARTBEAT_INTERVAL, UINT32_MAX, &tmpll) == -1) {
return (-2);
}
settings->heartbeat_interval_min = (uint32_t)tmpll;
} else if (strcasecmp(option, "heartbeat_interval_max") == 0) {
- tmpll = strtoll(value, &ep, 10);
- if (tmpll < QNETD_MIN_HEARTBEAT_INTERVAL || errno != 0 || *ep != '\0') {
+ if (utils_strtonum(value, QNETD_MIN_HEARTBEAT_INTERVAL, UINT32_MAX, &tmpll) == -1) {
return (-2);
}
@@ -159,8 +154,7 @@ qnetd_advanced_settings_set(struct qnetd_advanced_settings *settings,
settings->dpd_enabled = (uint8_t)tmpll;
} else if (strcasecmp(option, "dpd_interval") == 0) {
- tmpll = strtoll(value, &ep, 10);
- if (tmpll < QNETD_MIN_DPD_INTERVAL || errno != 0 || *ep != '\0') {
+ if (utils_strtonum(value, QNETD_MIN_DPD_INTERVAL, UINT32_MAX, &tmpll) == -1) {
return (-2);
}
@@ -178,29 +172,25 @@ qnetd_advanced_settings_set(struct qnetd_advanced_settings *settings,
return (-1);
}
} else if (strcasecmp(option, "local_socket_backlog") == 0) {
- tmpll = strtoll(value, &ep, 10);
- if (tmpll < QNETD_MIN_LOCAL_SOCKET_BACKLOG || errno != 0 || *ep != '\0') {
+ if (utils_strtonum(value, QNETD_MIN_LOCAL_SOCKET_BACKLOG, INT_MAX, &tmpll) == -1) {
return (-2);
}
settings->local_socket_backlog = (int)tmpll;
} else if (strcasecmp(option, "ipc_max_clients") == 0) {
- tmpll = strtoll(value, &ep, 10);
- if (tmpll < QNETD_MIN_IPC_MAX_CLIENTS || errno != 0 || *ep != '\0') {
+ if (utils_strtonum(value, QNETD_MIN_IPC_MAX_CLIENTS, LLONG_MAX, &tmpll) == -1) {
return (-2);
}
settings->ipc_max_clients = (size_t)tmpll;
} else if (strcasecmp(option, "ipc_max_receive_size") == 0) {
- tmpll = strtoll(value, &ep, 10);
- if (tmpll < QNETD_MIN_IPC_RECEIVE_SEND_SIZE || errno != 0 || *ep != '\0') {
+ if (utils_strtonum(value, QNETD_MIN_IPC_RECEIVE_SEND_SIZE, LLONG_MAX, &tmpll) == -1) {
return (-2);
}
settings->ipc_max_receive_size = (size_t)tmpll;
} else if (strcasecmp(option, "ipc_max_send_size") == 0) {
- tmpll = strtoll(value, &ep, 10);
- if (tmpll < QNETD_MIN_IPC_RECEIVE_SEND_SIZE || errno != 0 || *ep != '\0') {
+ if (utils_strtonum(value, QNETD_MIN_IPC_RECEIVE_SEND_SIZE, LLONG_MAX, &tmpll) == -1) {
return (-2);
}
diff --git a/exec/main.c b/exec/main.c
index 426e56d0..5523432b 100644
--- a/exec/main.c
+++ b/exec/main.c
@@ -1258,6 +1258,8 @@ int main (int argc, char **argv, char **envp)
} else if (strcmp(optarg, "min") == 0) {
prio = INT_MAX;
} else {
+ errno = 0;
+
tmpli = strtol(optarg, &ep, 10);
if (errno != 0 || *ep != '\0' || tmpli > INT_MAX || tmpli < INT_MIN) {
fprintf(stderr, "Priority value %s is invalid", optarg);

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Mon Mar 5 08:24:30 UTC 2018 - bliu@suse.com
- some coverity fixes for corosync on upstream(bsc#1083895)
Added: 0015-coverity-fixes.patch
-------------------------------------------------------------------
Wed Jan 31 05:59:06 UTC 2018 - bliu@suse.com

View File

@ -76,6 +76,7 @@ Patch18: 0011-libcpg-Fix-issue-with-partial-big-packet-assembly.patch
Patch19: 0012-totemudp-u-Drop-truncated-packets-on-receive.patch
Patch20: 0013-logging-Make-blackbox-configurable.patch
Patch21: 0014-logging-Close-before-and-open-blackbox-after-fork.patch
Patch22: 0015-coverity-fixes.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
# openais is indeed gone and should be uninstalled. Yes, we do not
@ -162,6 +163,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-build
%patch19 -p1
%patch20 -p1
%patch21 -p1
%patch22 -p1
%build
%if %{with runautogen}