Commit 20069fa3 by Christian Brauner Committed by GitHub

Merge pull request #1677 from 0x0916/2017-07-05/fix-parse-config-file

tests: delete the intermediate file and directory.
parents d552fc35 a6638e2e
...@@ -403,6 +403,7 @@ int main(int argc, char *argv[]) ...@@ -403,6 +403,7 @@ int main(int argc, char *argv[])
if (ret < 0) if (ret < 0)
return EXIT_FAILURE; return EXIT_FAILURE;
(void)rmdir(LXCPATH "/alternate-path-test");
TSTOUT("All tests passed\n"); TSTOUT("All tests passed\n");
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <unistd.h> #include <unistd.h>
#include <libgen.h>
#include "confile_utils.h" #include "confile_utils.h"
#include "lxc/state.h" #include "lxc/state.h"
...@@ -279,12 +280,6 @@ int main(int argc, char *argv[]) ...@@ -279,12 +280,6 @@ int main(int argc, char *argv[])
char tmpf[] = "lxc-parse-config-file-XXXXXX"; char tmpf[] = "lxc-parse-config-file-XXXXXX";
char retval[4096] = {0}; 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); fd = mkstemp(tmpf);
if (fd < 0) { if (fd < 0) {
lxc_error("%s\n", "Could not create temporary file"); lxc_error("%s\n", "Could not create temporary file");
...@@ -292,6 +287,11 @@ int main(int argc, char *argv[]) ...@@ -292,6 +287,11 @@ int main(int argc, char *argv[])
} }
close(fd); close(fd);
c = lxc_container_new(tmpf, NULL);
if (!c) {
lxc_error("%s\n", "Failed to create new container");
exit(EXIT_FAILURE);
}
/* lxc.arch */ /* lxc.arch */
if (set_get_compare_clear_save_load(c, "lxc.arch", "x86_64", tmpf, if (set_get_compare_clear_save_load(c, "lxc.arch", "x86_64", tmpf,
...@@ -986,7 +986,7 @@ int main(int argc, char *argv[]) ...@@ -986,7 +986,7 @@ int main(int argc, char *argv[])
ret = EXIT_SUCCESS; ret = EXIT_SUCCESS;
non_test_error: non_test_error:
(void)unlink(tmpf); (void)unlink(tmpf);
c->destroy(c); (void)rmdir(dirname(c->configfile));
lxc_container_put(c); lxc_container_put(c);
exit(ret); exit(ret);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment