2
0
mirror of git://github.com/lxc/lxc synced 2025-08-31 05:29:37 +00:00

create the container with an empty configuration

Fix the code to not fail when the specified configuration file
is empty.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
This commit is contained in:
Daniel Lezcano
2009-05-28 12:10:50 +02:00
parent 6203de18eb
commit 4fcc0112bd
2 changed files with 23 additions and 3 deletions

View 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;
}

View 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) {