]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Make commandtest more robust wrt its execution environment
authorDaniel P. Berrange <berrange@redhat.com>
Thu, 24 Feb 2011 12:12:27 +0000 (12:12 +0000)
committerDaniel P. Berrange <berrange@redhat.com>
Fri, 25 Feb 2011 11:02:08 +0000 (11:02 +0000)
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

index 7157c51328fe6cf49f935ed41f7ce107acf92c02..dc2f8a124b53a16786fdeb5a6eddacedd418548e 100644 (file)
@@ -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;