From: Long Wang Date: Wed, 5 Jul 2017 06:51:03 +0000 (+0800) Subject: tests: create temp file before lxc_container_new X-Git-Tag: lxc-2.1.0~66^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6cd5db20bce261d493cdb9cdb3556fdff66ec777;p=thirdparty%2Flxc.git tests: create temp file before lxc_container_new Signed-off-by: Long Wang --- diff --git a/src/tests/parse_config_file.c b/src/tests/parse_config_file.c index e20272fe7..0c9d717ec 100644 --- a/src/tests/parse_config_file.c +++ b/src/tests/parse_config_file.c @@ -279,12 +279,6 @@ int main(int argc, char *argv[]) char tmpf[] = "lxc-parse-config-file-XXXXXX"; char retval[4096] = {0}; - c = lxc_container_new(tmpf, NULL); - if (!c) { - lxc_error("%s\n", "failed to create new container"); - exit(EXIT_FAILURE); - } - fd = mkstemp(tmpf); if (fd < 0) { lxc_error("%s\n", "Could not create temporary file"); @@ -292,6 +286,11 @@ int main(int argc, char *argv[]) } close(fd); + c = lxc_container_new(tmpf, NULL); + if (!c) { + lxc_error("%s\n", "Failed to create new container"); + exit(EXIT_FAILURE); + } /* lxc.arch */ if (set_get_compare_clear_save_load(c, "lxc.arch", "x86_64", tmpf,