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()
This commit is contained in:
Daniel P. Berrange 2011-02-24 12:12:27 +00:00
parent 0905d1ee95
commit f0e9dfeca9

View 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;