2
0
mirror of git://github.com/lxc/lxc synced 2025-08-30 07:22:05 +00:00

tools: better error reporting for lxc-start

Signed-off-by: Christian Brauner <christian.brauner@canonical.com>
This commit is contained in:
Christian Brauner 2016-10-14 15:27:24 +02:00
parent 40e3d7a274
commit 040f39c45f
No known key found for this signature in database
GPG Key ID: 8EB056D53EECB12D

View File

@ -86,7 +86,7 @@ static int ensure_path(char **confpath, const char *path)
goto err;
}
}
err = 0;
err = EXIT_SUCCESS;
err:
free(fullpath);
@ -231,6 +231,12 @@ int main(int argc, char *argv[])
exit(err);
lxc_log_options_no_override();
if (access(my_args.lxcpath[0], O_RDWR) < 0) {
if (!my_args.quiet)
fprintf(stderr, "You lack access to %s\n", my_args.lxcpath[0]);
exit(err);
}
const char *lxcpath = my_args.lxcpath[0];
/*
@ -275,9 +281,19 @@ int main(int argc, char *argv[])
}
}
if (!c->is_defined(c)) {
fprintf(stderr, "Error: container %s is not defined\n", c->name);
goto out;
}
if (!c->may_control(c)) {
fprintf(stderr, "Insufficent privileges to control %s\n", c->name);
goto out;
}
if (c->is_running(c)) {
ERROR("Container is already running.");
err = 0;
err = EXIT_SUCCESS;
goto out;
}
/*