mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-08-03 00:56:22 +00:00
lxc-destroy return 255 in case of error
to have same exit code for all lxc commands Signed-off-by: Michel Normand <normand@fr.ibm.com> Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
This commit is contained in:
parent
7f8306138a
commit
79507e493e
@ -39,7 +39,7 @@ static int remove_lxc_directory(const char *dirname)
|
||||
{
|
||||
char path[MAXPATHLEN];
|
||||
|
||||
sprintf(path, LXCPATH "/%s", dirname);
|
||||
snprintf(path, MAXPATHLEN, LXCPATH "/%s", dirname);
|
||||
|
||||
if (rmdir(path)) {
|
||||
SYSERROR("failed to remove %s directory", path);
|
||||
@ -51,12 +51,12 @@ static int remove_lxc_directory(const char *dirname)
|
||||
|
||||
int lxc_destroy(const char *name)
|
||||
{
|
||||
int lock, ret = -LXC_ERROR_INTERNAL;
|
||||
int lock, ret = -1;
|
||||
char path[MAXPATHLEN];
|
||||
|
||||
lock = lxc_get_lock(name);
|
||||
if (lock < 0)
|
||||
return lock;
|
||||
return ret;
|
||||
|
||||
if (lxc_rmstate(name)) {
|
||||
ERROR("failed to remove state file for %s", name);
|
||||
|
@ -22,7 +22,6 @@
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <libgen.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <lxc/lxc.h>
|
||||
@ -48,20 +47,13 @@ Options :\n\
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = lxc_arguments_parse(&my_args, argc, argv);
|
||||
if (ret)
|
||||
return 1;
|
||||
if (lxc_arguments_parse(&my_args, argc, argv))
|
||||
return -1;
|
||||
|
||||
if (lxc_log_init(my_args.log_file, my_args.log_priority,
|
||||
my_args.progname, my_args.quiet))
|
||||
return 1;
|
||||
return -1;
|
||||
|
||||
ret = lxc_destroy(my_args.name);
|
||||
if (ret)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
return lxc_destroy(my_args.name);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user