From: Daniel P. Berrange Date: Thu, 24 Feb 2011 12:12:27 +0000 (+0000) Subject: Make commandtest more robust wrt its execution environment X-Git-Tag: CVE-2011-1146~90 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f0e9dfeca967d05f23409c838619d9357d4f7d7f;p=thirdparty%2Flibvirt.git 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() --- diff --git a/tests/commandtest.c b/tests/commandtest.c index 7157c51328..dc2f8a124b 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;