From 12509c09a55bd2ab171f9fa029fb94f297adc0a0 Mon Sep 17 00:00:00 2001 From: Daniel P. Berrange Date: Thu, 24 Feb 2011 12:12:27 +0000 Subject: [PATCH] Make commandtest more robust wrt its execution environment When executed from cron, commandtest would fail to correctly identify daemon processes. Set session ID and process group IDs at startup to ensure we have a consistent environment to run in. * tests/commandtest.c: Call setsid() and setpgid() --- tests/commandtest.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/tests/commandtest.c b/tests/commandtest.c index 7157c51..dc2f8a1 100644 --- a/tests/commandtest.c +++ b/tests/commandtest.c @@ -730,6 +730,9 @@ mymain(int argc, char **argv) if (chdir("/tmp") < 0) return(EXIT_FAILURE); + setpgid(0, 0); + setsid(); + /* Kill off any inherited fds that might interfere with our * testing. */ fd = 3; -- 1.7.3.4