tests: daemonize in startone

This should finally silence this test for good :)

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
This commit is contained in:
Stéphane Graber 2014-03-13 10:16:34 -04:00
parent e9c5dc7ba3
commit 4fd0838c69

View File

@ -163,24 +163,11 @@ int main(int argc, char *argv[])
fprintf(stderr, "%d: failed to get extra ref to container\n", __LINE__);
exit(1);
}
c->want_daemonize(c, false);
pid_t pid = fork();
if (pid < 0) {
fprintf(stderr, "%d: fork failed\n", __LINE__);
goto out;
}
if (pid == 0) {
close(0);
close(1);
close(2);
open("/dev/zero", O_RDONLY);
open("/dev/null", O_RDWR);
open("/dev/null", O_RDWR);
b = c->startl(c, 0, NULL);
if (!b)
fprintf(stderr, "%d: %s failed to start\n", __LINE__, c->name);
lxc_container_put(c);
exit(!b);
c->want_daemonize(c, true);
if (!c->startl(c, 0, NULL)) {
fprintf(stderr, "%d: %s failed to start\n", __LINE__, c->name);
exit(1);
}
sleep(3);