Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6dc69f97 authored by Amit Shah's avatar Amit Shah Committed by Rusty Russell
Browse files

virtio: console: Return -EPIPE to hvc_console if we lost the connection



hvc_console handles -EPIPE properly when the connection to the host is
lost.

Signed-off-by: default avatarAmit Shah <amit.shah@redhat.com>
Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
parent eaeff960
Loading
Loading
Loading
Loading
+6 −2
Original line number Original line Diff line number Diff line
@@ -653,7 +653,7 @@ static int put_chars(u32 vtermno, const char *buf, int count)


	port = find_port_by_vtermno(vtermno);
	port = find_port_by_vtermno(vtermno);
	if (!port)
	if (!port)
		return 0;
		return -EPIPE;


	return send_buf(port, (void *)buf, count);
	return send_buf(port, (void *)buf, count);
}
}
@@ -669,9 +669,13 @@ static int get_chars(u32 vtermno, char *buf, int count)
{
{
	struct port *port;
	struct port *port;


	/* If we've not set up the port yet, we have no input to give. */
	if (unlikely(early_put_chars))
		return 0;

	port = find_port_by_vtermno(vtermno);
	port = find_port_by_vtermno(vtermno);
	if (!port)
	if (!port)
		return 0;
		return -EPIPE;


	/* If we don't have an input queue yet, we can't get input. */
	/* If we don't have an input queue yet, we can't get input. */
	BUG_ON(!port->in_vq);
	BUG_ON(!port->in_vq);