lxc-console to 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:
Michel Normand 2009-05-18 22:27:36 +02:00 committed by Daniel Lezcano
parent a30284df84
commit 2ea004b8c6
2 changed files with 6 additions and 7 deletions

View File

@ -37,7 +37,7 @@ lxc_log_define(lxc_console, lxc);
extern int lxc_console(const char *name, int ttynum, int *fd)
{
struct sockaddr_un addr = { 0 };
int sock, ret = -LXC_ERROR_TTY_EAGAIN;
int sock, ret = -1;
snprintf(addr.sun_path, sizeof(addr.sun_path), "@%s", name);
addr.sun_path[0] = '\0';
@ -64,7 +64,6 @@ extern int lxc_console(const char *name, int ttynum, int *fd)
if (!ret) {
ERROR("console denied by '%s'", name);
ret = -LXC_ERROR_TTY_DENIED;
goto out_close;
}

View File

@ -81,17 +81,17 @@ int main(int argc, char *argv[])
err = lxc_arguments_parse(&my_args, argc, argv);
if (err)
return 1;
return -1;
if (lxc_log_init(my_args.log_file, my_args.log_priority,
my_args.progname, my_args.quiet))
return 1;
return -1;
/* Get current termios */
if (tcgetattr(0, &tios)) {
ERROR("failed to get current terminal settings : %s",
strerror(errno));
return 1;
return -1;
}
oldtios = tios;
@ -108,7 +108,7 @@ int main(int argc, char *argv[])
if (tcsetattr(0, TCSAFLUSH, &tios)) {
ERROR("failed to set new terminal settings : %s",
strerror(errno));
return 1;
return -1;
}
err = lxc_console(my_args.name, my_args.ttynum, &master);
@ -190,6 +190,6 @@ out:
return err;
out_err:
err = 1;
err = -1;
goto out;
}