Commit 2ea004b8 by Michel Normand Committed by Daniel Lezcano

lxc-console to return 255 in case of error

to have same exit code for all lxc commands Signed-off-by: 's avatarMichel Normand <normand@fr.ibm.com> Signed-off-by: 's avatarDaniel Lezcano <dlezcano@fr.ibm.com>
parent a30284df
......@@ -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;
}
......
......@@ -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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment