From: George Dunlap <george.dunlap@eu.citrix.com>
To: Ian Jackson <ian.jackson@eu.citrix.com>, xen-devel@lists.xensource.com
Cc: Ian Campbell <Ian.Campbell@citrix.com>,
M A Young <m.a.young@durham.ac.uk>
Subject: Re: [PATCH 1/2] tools/console: reset tty when xenconsole fails
Date: Mon, 17 Mar 2014 16:35:28 +0000 [thread overview]
Message-ID: <53272450.3010808@eu.citrix.com> (raw)
In-Reply-To: <1395073457-2584-2-git-send-email-ian.jackson@eu.citrix.com>
On 03/17/2014 04:24 PM, Ian Jackson wrote:
> If xenconsole (the client program) fails, it calls err. This would
> previously neglect to reset the user's terminal to sanity. Use atexit
> to do so.
>
> This routinely happens in Xen 4.4 RC5 with pygrub because something
> writes the value "" to the tty xenstore key when using xenconsole.
> The cause of this is not yet known, but after this patch it just
> results in a harmless error message.
Is it the case that the cause of this is still not yet known? It seemed
to be explained by the subsequent patch. :-)
In any case:
Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
>
> Reported-by: M A Young <m.a.young@durham.ac.uk>
> Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
> CC: M A Young <m.a.young@durham.ac.uk>
> CC: Ian Campbell <Ian.Campbell@citrix.com>
> CC: George Dunlap <george.dunlap@eu.citrix.com>
> ---
> tools/console/client/main.c | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/tools/console/client/main.c b/tools/console/client/main.c
> index eb6a1a9..62159f6 100644
> --- a/tools/console/client/main.c
> +++ b/tools/console/client/main.c
> @@ -257,6 +257,13 @@ typedef enum {
> CONSOLE_SERIAL,
> } console_type;
>
> +static struct termios stdin_old_attr;
> +
> +static void restore_term_stdin(void)
> +{
> + restore_term(STDIN_FILENO, &stdin_old_attr);
> +}
> +
> int main(int argc, char **argv)
> {
> struct termios attr;
> @@ -383,9 +390,9 @@ int main(int argc, char **argv)
> }
>
> init_term(spty, &attr);
> - init_term(STDIN_FILENO, &attr);
> + init_term(STDIN_FILENO, &stdin_old_attr);
> + atexit(restore_term_stdin); /* if this fails, oh dear */
> console_loop(spty, xs, path);
> - restore_term(STDIN_FILENO, &attr);
>
> free(path);
> free(dom_path);
next prev parent reply other threads:[~2014-03-17 16:35 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-17 16:24 [PATCH 1/2] tools/console: Error handling fixes Ian Jackson
2014-03-17 16:24 ` [PATCH 1/2] tools/console: reset tty when xenconsole fails Ian Jackson
2014-03-17 16:35 ` George Dunlap [this message]
2014-03-17 17:08 ` Ian Jackson
2014-03-18 17:26 ` Ian Campbell
2014-03-17 16:24 ` [PATCH 2/2] tools/console: xenconsole tolerate tty errors Ian Jackson
2014-03-18 17:27 ` Ian Campbell
2014-03-18 17:58 ` Ian Jackson
2014-03-18 18:00 ` [PATCH v2 1/2] tools/console: reset tty when xenconsole fails Ian Jackson
2014-03-18 18:00 ` [PATCH v2 2/2] tools/console: xenconsole tolerate tty errors Ian Jackson
2014-03-19 9:57 ` Ian Campbell
2014-03-19 13:38 ` Ian Jackson
2014-03-19 17:38 ` [PATCH v2 1/2] tools/console: reset tty when xenconsole fails Anthony Liguori
2014-03-20 11:37 ` Ian Jackson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53272450.3010808@eu.citrix.com \
--to=george.dunlap@eu.citrix.com \
--cc=Ian.Campbell@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=m.a.young@durham.ac.uk \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.