We should never be able to get to this point with that being NULL.
Going with this instead, thanks for pointing out the problem!
diff --git a/src/lib/mainloop.c b/src/lib/mainloop.c
index 7cc27e7..d3426a4 100644
--- a/src/lib/mainloop.c
+++ b/src/lib/mainloop.c
@@ -400,7 +400,8 @@ mainloop_add_child(pid_t pid, int timeout, const
char *desc, void * privatedata,
void (*callback)(mainloop_child_t *p, int status, int signo,
int exitcode))
{
- mainloop_child_t* p = g_new(mainloop_child_t, 1);
+ mainloop_child_t *p = g_new(mainloop_child_t, 1);
+
if (mainloop_process_table == NULL) {
mainloop_process_table = g_hash_table_new_full(
g_direct_hash, g_direct_equal, NULL, NULL/*TODO: Add
destructor */);
@@ -473,6 +474,11 @@ child_death_dispatch(int sig)
void
mainloop_track_children(int priority)
{
+ if (mainloop_process_table == NULL) {
+ mainloop_process_table = g_hash_table_new_full(
+ g_direct_hash, g_direct_equal, NULL, NULL/*TODO: Add
destructor */);
+ }
+
#if __linux__
mainloop_add_signal(SIGCHLD, child_death_dispatch);
#endif
On Fri, Apr 29, 2011 at 6:21 AM, Angus Salkeld <asalkeld(a)redhat.com> wrote:
When running a resource start/monitor with a timeout of 0 (blocking)
we are not using the "managed child process" code. So we end up in
child_death_dispatch() with a NULL process_table - as it wasn't added in
services_os_action_execute(). We could mask out this signal but
there might be other managed processes. So this is a simple solution.
Can you port to rhel6 please?
Signed-off-by: Angus Salkeld <asalkeld(a)redhat.com>
---
src/lib/mainloop.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/src/lib/mainloop.c b/src/lib/mainloop.c
index 7cc27e7..6a67c05 100644
--- a/src/lib/mainloop.c
+++ b/src/lib/mainloop.c
@@ -431,6 +431,9 @@ child_death_dispatch(int sig)
if (pid > 0) {
int signo = 0, exitcode = 0;
+ if (mainloop_process_table == NULL) {
+ continue;
+ }
mainloop_child_t *p = g_hash_table_lookup(mainloop_process_table,
GINT_TO_POINTER(pid));
mh_trace("Managed process %d exited: %p", pid, p);
if (p == NULL) {
--
1.7.4.4
_______________________________________________
Matahari mailing list
Matahari(a)lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/matahari