[Devel] Re: [PATCH trivial] pty: set tty on error

Oren Laadan orenl at librato.com
Fri Sep 18 10:21:14 PDT 2009



Serge E. Hallyn wrote:
> we always return tty expecting it to hold the error code.
> 
> Signed-off-by: Serge E. Hallyn <serue at us.ibm.com>
> ---
>  drivers/char/tty_io.c |    6 +++++-
>  1 files changed, 5 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
> index 1729b2f..ee95938 100644
> --- a/drivers/char/tty_io.c
> +++ b/drivers/char/tty_io.c
> @@ -3033,8 +3033,12 @@ static struct tty_struct *do_restore_tty(struct ckpt_ctx *ctx)
>  	 */
>  	if (master) {
>  		file = pty_open_by_index("/dev/ptmx", h->index);
> -		if (IS_ERR(file))
> +		if (IS_ERR(file)) {
> +			ckpt_write_err(ctx, "TE", "Error %d opening /dev/ptmx",
> +				PTR_ERR(file));

The 'E' in the first format string already geenrates "err %d" and
the integer PTR_ERR(file). The explicit "Error %d" is redundant (and
requires another integer).

See (now added) documentation to __ckpt_generate_err() in the code.

Oren.

> +			tty = ERR_PTR(PTR_ERR(file));
>  			goto out;
> +		}
>  
>  		/*
>  		 * Add file to objhash to ensure proper cleanup later
_______________________________________________
Containers mailing list
Containers at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers




More information about the Devel mailing list