summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel P. Berrange <berrange@redhat.com>2011-02-24 12:12:27 +0000
committerDaniel P. Berrange <berrange@redhat.com>2011-02-25 11:02:08 +0000
commitf0e9dfeca967d05f23409c838619d9357d4f7d7f (patch)
treec83021380428f225dc79b3cab8af7d6498995288 /tests/commandtest.c
parentFix spelling mistake: seek (diff)
downloadlibvirt-f0e9dfeca967d05f23409c838619d9357d4f7d7f.tar.gz
libvirt-f0e9dfeca967d05f23409c838619d9357d4f7d7f.tar.bz2
libvirt-f0e9dfeca967d05f23409c838619d9357d4f7d7f.zip
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()
Diffstat (limited to 'tests/commandtest.c')
-rw-r--r--tests/commandtest.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/commandtest.c b/tests/commandtest.c
index 7157c5132..dc2f8a124 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;