提交 f0e9dfec 编写于 作者: D Daniel P. Berrange

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()
上级 0905d1ee
...@@ -730,6 +730,9 @@ mymain(int argc, char **argv) ...@@ -730,6 +730,9 @@ mymain(int argc, char **argv)
if (chdir("/tmp") < 0) if (chdir("/tmp") < 0)
return(EXIT_FAILURE); return(EXIT_FAILURE);
setpgid(0, 0);
setsid();
/* Kill off any inherited fds that might interfere with our /* Kill off any inherited fds that might interfere with our
* testing. */ * testing. */
fd = 3; fd = 3;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册