From bf705a1ef3384b46301534b97d9439de92ce2e2d Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Fri, 8 Jun 2018 10:20:21 +0200 Subject: [PATCH] lxc enter: fix read from non-blocking web socket --- PVE/APIClient/Commands/lxc.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/PVE/APIClient/Commands/lxc.pm b/PVE/APIClient/Commands/lxc.pm index 6c9603a..879d7c3 100644 --- a/PVE/APIClient/Commands/lxc.pm +++ b/PVE/APIClient/Commands/lxc.pm @@ -202,7 +202,9 @@ __PACKAGE__->register_method ({ my $wb_socket_read_available_bytes = sub { my $nr = $web_socket->sysread($wsbuf, $max_payload_size, length($wsbuf)); - die "web socket read error - $!\n" if $nr < 0; + if (!defined($nr) && !($! == EINTR || $! == EAGAIN)) { + die "web socket read error - $!\n"; + } return $nr; }; @@ -318,7 +320,7 @@ __PACKAGE__->register_method ({ my $nr = $wb_socket_read_available_bytes->(); if (!defined($nr)) { - die "web socket read error $!\n"; + # wait } elsif ($nr == 0) { return; # EOF } else { -- 2.39.2