func_test: report failure in test_sql() if syslog-ng crashes

The testcase explicitly stopped syslog-ng, but didn't validate its return
code. Fix that.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>
mainloop: fix the handling of interleaving terminate/reload operations

This patch aborts the reload process if termination is requested. The
solution was to extend the use of the "under_termination" variable, which
is not really nice.

The alternative, better approach would be to serialize intrusive requests
(e.g. reload/terminate) with a queue or something. If that were the
case, no explicit handling would be needed.

Signed-off-by: Balazs Scheidler <bazsi@balabit.hu>