All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH trivial] pty: set tty on error
@ 2009-09-18 15:55 Serge E. Hallyn
       [not found] ` <20090918155507.GA1329-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Serge E. Hallyn @ 2009-09-18 15:55 UTC (permalink / raw)
  To: Linux Containers

we always return tty expecting it to hold the error code.

Signed-off-by: Serge E. Hallyn <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
---
 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));
+			tty = ERR_PTR(PTR_ERR(file));
 			goto out;
+		}
 
 		/*
 		 * Add file to objhash to ensure proper cleanup later
-- 
1.6.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH trivial] pty: set tty on error
       [not found] ` <20090918155507.GA1329-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
@ 2009-09-18 17:00   ` Oren Laadan
  2009-09-18 17:21   ` Oren Laadan
  1 sibling, 0 replies; 3+ messages in thread
From: Oren Laadan @ 2009-09-18 17:00 UTC (permalink / raw)
  To: Serge E. Hallyn; +Cc: Linux Containers


got it, thanks.

Serge E. Hallyn wrote:
> we always return tty expecting it to hold the error code.
> 
> Signed-off-by: Serge E. Hallyn <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
> ---
>  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));
> +			tty = ERR_PTR(PTR_ERR(file));
>  			goto out;
> +		}
>  
>  		/*
>  		 * Add file to objhash to ensure proper cleanup later

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH trivial] pty: set tty on error
       [not found] ` <20090918155507.GA1329-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
  2009-09-18 17:00   ` Oren Laadan
@ 2009-09-18 17:21   ` Oren Laadan
  1 sibling, 0 replies; 3+ messages in thread
From: Oren Laadan @ 2009-09-18 17:21 UTC (permalink / raw)
  To: Serge E. Hallyn; +Cc: Linux Containers



Serge E. Hallyn wrote:
> we always return tty expecting it to hold the error code.
> 
> Signed-off-by: Serge E. Hallyn <serue-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
> ---
>  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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-09-18 17:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-18 15:55 [PATCH trivial] pty: set tty on error Serge E. Hallyn
     [not found] ` <20090918155507.GA1329-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>
2009-09-18 17:00   ` Oren Laadan
2009-09-18 17:21   ` Oren Laadan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.