worker result parsing: Fix typo in gperf input file

s/error_message/error_msg/

Signed-off-by: Andreas Ericsson <ae@op5.se>
daemon: Make query socket path main-config-relative

This just brings it in line with all the other path-variables and
makes testing a little bit easier.

Signed-off-by: Andreas Ericsson <ae@op5.se>
lib/worker: Close input filedescriptors more aggressively

Previously it was possible to end up in the infinite loop of doom
between check_completion() and gather_output() (since the former
calls the latter and vice versa), leading to a coredump when we run
out of stack space. With this patch, that really shouldn't happen,
since we'll now close the offending filedescriptor before we call
out to check_completion() from gather_output(), which means we'll
at most be called upon once to get the final output from each
filedescriptor.

We also avoid calling wait4() without WNOHANG, as that could otherwise
lead us to wait forever in case plugins end up in uninterruptible sleep.

Signed-off-by: Andreas Ericsson <ae@op5.se>
lib/worker: Maintain a kill-queue of processes we fail to reap

Previously it was possible for us to send SIGKILL to our children
and then attempt to reap the child before it had received the signal,
which caused the process to become a zombie.

If we indeed do fail to reap the process after killing it, we'll try
again a few seconds later, and keep on trying every few seconds
until we've either successfully reaped the child, it goes away by
some other means (such as being traced and having its parent
altered), or we get shut down, in which case it's init's problem.

This covers scenarios where the child is stuck in uninterruptable
sleep (such as after a vfork() call, f.e.), but not those where the
plugin itself alters its own process group after its inception.

Signed-off-by: Andreas Ericsson <ae@op5.se>
Avoid crashing when freeing objects after parsing faulty configuration

When we get bad serviceescalations or other entries where we had
already counted the host and servicedependencies but not sorted
them into their list yet, we would go ahead and shut down, calling
the free_object_data() function which would happily try to access
entries in hostdependency_ary and servicedependency_ary, which
caused the crashes mentioned in the subject line.

This patch fixes that particular corner case.

Signed-off-by: Andreas Ericsson <ae@op5.se>