mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-08-11 20:21:23 +00:00
tests: cleanup destroytest.c
Signed-off-by: 2xsec <dh48.jeong@samsung.com>
This commit is contained in:
parent
17d11ff744
commit
8d72e58a24
@ -37,24 +37,30 @@ static int create_container(void)
|
|||||||
perror("fork");
|
perror("fork");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pid == 0) {
|
if (pid == 0) {
|
||||||
execlp("lxc-create", "lxc-create", "-t", "busybox", "-n", MYNAME, NULL);
|
execlp("lxc-create", "lxc-create", "-t", "busybox", "-n", MYNAME, NULL);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
again:
|
again:
|
||||||
ret = waitpid(pid, &status, 0);
|
ret = waitpid(pid, &status, 0);
|
||||||
if (ret == -1) {
|
if (ret == -1) {
|
||||||
if (errno == EINTR)
|
if (errno == EINTR)
|
||||||
goto again;
|
goto again;
|
||||||
|
|
||||||
perror("waitpid");
|
perror("waitpid");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret != pid)
|
if (ret != pid)
|
||||||
goto again;
|
goto again;
|
||||||
|
|
||||||
if (!WIFEXITED(status)) { // did not exit normally
|
if (!WIFEXITED(status)) { // did not exit normally
|
||||||
fprintf(stderr, "%d: lxc-create exited abnormally\n", __LINE__);
|
fprintf(stderr, "%d: lxc-create exited abnormally\n", __LINE__);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return WEXITSTATUS(status);
|
return WEXITSTATUS(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,6 +102,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
fprintf(stderr, "all lxc_container tests passed for %s\n", c->name);
|
fprintf(stderr, "all lxc_container tests passed for %s\n", c->name);
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
lxc_container_put(c);
|
lxc_container_put(c);
|
||||||
exit(ret);
|
exit(ret);
|
||||||
|
Loading…
Reference in New Issue
Block a user