mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-08-08 12:18:51 +00:00
lxc-stop: exit with 1 or 2, not -1 or -2.
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
This commit is contained in:
parent
01e6b71480
commit
b93aac46f2
@ -130,14 +130,14 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
struct lxc_container *c;
|
struct lxc_container *c;
|
||||||
bool s;
|
bool s;
|
||||||
int ret = -1;
|
int ret = 1;
|
||||||
|
|
||||||
if (lxc_arguments_parse(&my_args, argc, argv))
|
if (lxc_arguments_parse(&my_args, argc, argv))
|
||||||
return -1;
|
return 1;
|
||||||
|
|
||||||
if (lxc_log_init(my_args.name, my_args.log_file, my_args.log_priority,
|
if (lxc_log_init(my_args.name, my_args.log_file, my_args.log_priority,
|
||||||
my_args.progname, my_args.quiet, my_args.lxcpath[0]))
|
my_args.progname, my_args.quiet, my_args.lxcpath[0]))
|
||||||
return -1;
|
return 1;
|
||||||
|
|
||||||
c = lxc_container_new(my_args.name, my_args.lxcpath[0]);
|
c = lxc_container_new(my_args.name, my_args.lxcpath[0]);
|
||||||
if (!c) {
|
if (!c) {
|
||||||
@ -147,12 +147,12 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (!c->is_running(c)) {
|
if (!c->is_running(c)) {
|
||||||
fprintf(stderr, "%s is not running\n", c->name);
|
fprintf(stderr, "%s is not running\n", c->name);
|
||||||
ret = -2;
|
ret = 2;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (my_args.hardstop) {
|
if (my_args.hardstop) {
|
||||||
ret = c->stop(c) ? 0 : -1;
|
ret = c->stop(c) ? 0 : 1;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if (my_args.reboot) {
|
if (my_args.reboot) {
|
||||||
@ -163,9 +163,9 @@ int main(int argc, char *argv[])
|
|||||||
s = c->shutdown(c, my_args.timeout);
|
s = c->shutdown(c, my_args.timeout);
|
||||||
if (!s) {
|
if (!s) {
|
||||||
if (!my_args.shutdown)
|
if (!my_args.shutdown)
|
||||||
ret = c->wait(c, "STOPPED", -1) ? 0 : -1;
|
ret = c->wait(c, "STOPPED", -1) ? 0 : 1;
|
||||||
else
|
else
|
||||||
ret = -1; // fail
|
ret = 1; // fail
|
||||||
} else
|
} else
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user