[CRIU] [PATCH] tty: Fix compilation warrning
Cyrill Gorcunov
gorcunov at openvz.org
Thu Oct 30 06:05:32 PDT 2014
| tty.c: In function ‘tty_restore_ctl_terminal’:
| include/criu-log.h:42:16: error: ‘index’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
Same time assign CONSOLE_INDEX for debug info.
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
tty.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tty.c b/tty.c
index 7d5f73a4606f..b076f06193dd 100644
--- a/tty.c
+++ b/tty.c
@@ -486,7 +486,7 @@ static int tty_restore_ctl_terminal(struct file_desc *d, int fd)
{
struct tty_info *info = container_of(d, struct tty_info, d);
struct reg_file_info *fake = NULL;
- int slave = -1, ret = -1, index;
+ int slave = -1, ret = -1, index = -1;
if (!is_service_fd(fd, CTL_TTY_OFF))
return 0;
@@ -503,7 +503,7 @@ static int tty_restore_ctl_terminal(struct file_desc *d, int fd)
}
} else if (info->type == TTY_TYPE_CONSOLE) {
slave = open_pty_reg(info->reg_d, O_RDONLY);
- index = -1;
+ index = CONSOLE_INDEX;
if (slave < 0) {
pr_perror("Can't open %s", path_from_reg(info->reg_d));
goto err;
--
1.9.3
More information about the CRIU
mailing list