Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP3:GA
pacemaker.13547
pacemaker-libservices-recurring-actions-table-c...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File pacemaker-libservices-recurring-actions-table-created-before-using.patch of Package pacemaker.13547
commit 1c534b5a773df5b62aeb8a46842d1e2d4d2266ef Author: Ken Gaillot <kgaillot@redhat.com> Date: Wed Mar 1 15:04:35 2017 -0600 Fix: libservices: ensure recurring actions table is created before using diff --git a/lib/services/services.c b/lib/services/services.c index 52d3b556c..679f8e78b 100644 --- a/lib/services/services.c +++ b/lib/services/services.c @@ -90,6 +90,15 @@ resources_find_service_class(const char *agent) return NULL; } +static inline void +init_recurring_actions(void) +{ + if (recurring_actions == NULL) { + recurring_actions = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, + NULL); + } +} + /*! * \internal * \brief Check whether op is in-flight systemd or upstart op @@ -513,9 +522,11 @@ services_action_cancel(const char *name, const char *action, int interval) { gboolean cancelled = FALSE; char *id = generate_op_key(name, action, interval); - svc_action_t *op = g_hash_table_lookup(recurring_actions, id); + svc_action_t *op = NULL; /* We can only cancel a recurring action */ + init_recurring_actions(); + op = g_hash_table_lookup(recurring_actions, id); if (op == NULL) { goto done; } @@ -575,6 +586,7 @@ services_action_kick(const char *name, const char *action, int interval /* ms */ svc_action_t * op = NULL; char *id = generate_op_key(name, action, interval); + init_recurring_actions(); op = g_hash_table_lookup(recurring_actions, id); free(id); @@ -604,11 +616,6 @@ handle_duplicate_recurring(svc_action_t * op, void (*action_callback) (svc_actio { svc_action_t * dup = NULL; - if (recurring_actions == NULL) { - recurring_actions = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL); - return FALSE; - } - /* check for duplicates */ dup = g_hash_table_lookup(recurring_actions, op->id); @@ -700,6 +707,7 @@ services_action_async(svc_action_t * op, void (*action_callback) (svc_action_t * } if (op->interval > 0) { + init_recurring_actions(); if (handle_duplicate_recurring(op, action_callback) == TRUE) { /* entry rescheduled, dup freed */ /* exit early */
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor