[CRIU] [PATCH] tty: Fix compilation warrning

Tycho Andersen tycho.andersen at canonical.com
Thu Oct 30 06:33:16 PDT 2014


On Thu, Oct 30, 2014 at 04:05:32PM +0300, Cyrill Gorcunov wrote:
>  | 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]

Huh, my compiler didn't complain, sorry about that.

Acked-by: Tycho Andersen <tycho.andersen at canonical.com>

> 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
> 
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu


More information about the CRIU mailing list