]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
create the container with an empty configuration
authorDaniel Lezcano <dlezcano@fr.ibm.com>
Thu, 28 May 2009 10:10:50 +0000 (12:10 +0200)
committerDaniel Lezcano <dlezcano@fr.ibm.com>
Thu, 28 May 2009 10:10:50 +0000 (12:10 +0200)
Fix the code to not fail when the specified configuration file
is empty.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
src/lxc/lxc_create.c
src/lxc/parse.c

index 9d23aa9c3a01aeba2f207a3e15318bec8653f395..d6a3a9ba5a2b58870e5df3d1511c08a7afac5266 100644 (file)
@@ -35,6 +35,8 @@
 #include "confile.h"
 #include "arguments.h"
 
+lxc_log_define(lxc_create, lxc);
+
 static int my_parser(struct lxc_arguments* args, int c, char* arg)
 {
        switch (c) {
@@ -63,6 +65,11 @@ Options :\n\
        .checker  = NULL,
 };
 
+static int copy_config_file(const char *name, const char *file)
+{
+       return 0;
+}
+
 int main(int argc, char *argv[])
 {
        struct lxc_conf lxc_conf;
@@ -79,9 +86,22 @@ int main(int argc, char *argv[])
        if (lxc_conf_init(&lxc_conf))
                return -1;
 
-       if (my_args.rcfile && lxc_config_read(my_args.rcfile, &lxc_conf))
+       if (my_args.rcfile && lxc_config_read(my_args.rcfile, &lxc_conf)) {
+               ERROR("failed to read the configuration file");
                return -1;
+       }
 
-       return lxc_create(my_args.name, &lxc_conf);
+       if (lxc_create(my_args.name, &lxc_conf)) {
+               ERROR("failed to create the container");
+               return -1;
+       }
+
+       if (copy_config_file(my_args.name, my_args.rcfile)) {
+               ERROR("failed to copy the configuration file");
+               lxc_destroy(my_args.name);
+               return -1;
+       }
+
+       return 0;
 }
 
index 5cd8470ef14d08a758b94b4d412cd4f49e2e2316..b3d1194ebe9bce3db403af3a40e973fd69c22fa2 100644 (file)
@@ -67,7 +67,7 @@ int lxc_file_for_each_line(const char *file, lxc_file_cb callback,
                           char *buffer, size_t len, void* data)
 {
        FILE *f;
-       int err = -1;
+       int err = 0;
 
        f = fopen(file, "r");
        if (!f) {