|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 2/2] tools/console: xenconsole tolerate tty errors
On Mon, 2014-03-17 at 16:24 +0000, Ian Jackson wrote:
> Since 28d386fc4341 (XSA-57), libxl writes an empty value for the
> console tty node, with read-only permission for the guest, when
> setting up pv console "frontends". (The actual tty value is later set
> by xenconsoled.) Writing an empty node is not strictly necessary to
> stop the frontend from writing dangerous values here, but it is a good
> belt-and-braces approach.
>
> Unfortunately this confuses xenconsole. It reads the empty value, and
> tries to open it as the tty. xenconsole then exits.
>
> Fix this by having xenconsole treat an empty value the same way as no
> value at all.
>
> Also, make the error opening the tty be nonfatal: we just print a
> warning, but do not exit. I think this is helpful in theoretical
> situations where xenconsole is racing with libxl and/or xenconsoled.
>
> Signed-off-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
> CC: Ian Campbell <Ian.Campbell@xxxxxxxxxx>
> CC: George Dunlap <george.dunlap@xxxxxxxxxxxxx>
> ---
> tools/console/client/main.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/tools/console/client/main.c b/tools/console/client/main.c
> index 62159f6..b882345 100644
> --- a/tools/console/client/main.c
> +++ b/tools/console/client/main.c
> @@ -115,9 +115,11 @@ static int get_pty_fd(struct xs_handle *xs, char *path,
> int seconds)
> * disambiguate: just read the pty path */
> pty_path = xs_read(xs, XBT_NULL, path, &len);
> if (pty_path != NULL) {
> - pty_fd = open(pty_path, O_RDWR | O_NOCTTY);
> - if (pty_fd == -1)
> - err(errno, "Could not open tty `%s'",
> pty_path);
> + if (pty_path[0] != '\0') {
Can the top-level condition not be
if ( pty_path != NULL && pty_path[0] != '\0' )
avoiding the reindent?
Ack on the intent though.
> + pty_fd = open(pty_path, O_RDWR |
> O_NOCTTY);
> + if (pty_fd == -1)
> + warn("Could not open tty `%s'",
> pty_path);
> + }
> free(pty_path);
> }
> }
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |