File pacemaker-libcrmservices-avoid-assert-HB-resource-with-no-parameters.patch of Package pacemaker.14737
commit 53f3b82a8cae2251d62a56c743e7a82dda65f681
Author: Ken Gaillot <kgaillot@redhat.com>
Date: Fri Sep 22 14:06:50 2017 -0500
Low: libcrmservices: avoid assert for HB resource with no parameters
diff --git a/lib/services/services.c b/lib/services/services.c
index 35fd68085..f3a3e6d9d 100644
--- a/lib/services/services.c
+++ b/lib/services/services.c
@@ -256,19 +256,21 @@ resources_action_create(const char *name, const char *standard, const char *prov
/* The "heartbeat" agent class only has positional arguments,
* which we keyed by their decimal position number. */
param_num = 1;
- for (index = 1; index <= MAX_ARGC - 3; index++ ) {
- snprintf(buf_tmp, sizeof(buf_tmp), "%d", index);
- value_tmp = g_hash_table_lookup(params, buf_tmp);
- if (value_tmp == NULL) {
- /* maybe: strdup("") ??
- * But the old lrmd did simply continue as well. */
- continue;
+ if (params) {
+ for (index = 1; index <= MAX_ARGC - 3; index++ ) {
+ snprintf(buf_tmp, sizeof(buf_tmp), "%d", index);
+ value_tmp = g_hash_table_lookup(params, buf_tmp);
+ if (value_tmp == NULL) {
+ /* maybe: strdup("") ??
+ * But the old lrmd did simply continue as well. */
+ continue;
+ }
+ op->opaque->args[param_num++] = strdup(value_tmp);
}
- op->opaque->args[param_num++] = strdup(value_tmp);
}
/* Add operation code as the last argument, */
- /* and the teminating NULL pointer */
+ /* and the terminating NULL pointer */
op->opaque->args[param_num++] = strdup(op->action);
op->opaque->args[param_num] = NULL;
#endif