From 4650d96ea6bc10d4cbfe2d0926242136ea722bb2 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 29 Nov 2016 00:48:14 +0000 Subject: [PATCH] activation test: don't crash if AppArmor is built but unavailable Also don't try to clean up a process we didn't start. Signed-off-by: Simon McVittie --- test/sd-activation.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/test/sd-activation.c b/test/sd-activation.c index 24ac210..810d622 100644 --- a/test/sd-activation.c +++ b/test/sd-activation.c @@ -801,9 +801,15 @@ teardown (Fixture *f, f->activated = NULL; } - test_kill_pid (f->daemon_pid); - g_spawn_close_pid (f->daemon_pid); - test_main_context_unref (f->ctx); + if (f->daemon_pid != 0) + { + test_kill_pid (f->daemon_pid); + g_spawn_close_pid (f->daemon_pid); + } + + if (f->ctx != NULL) + test_main_context_unref (f->ctx); + g_free (f->address); } -- 2.10.2