Add comment, to stress that the order of operation (first drop old fds, second check read status) is intended.
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsement...@yandex-team.ru> Reviewed-by: Daniel P. Berrangé <berra...@redhat.com> --- chardev/char-socket.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/chardev/char-socket.c b/chardev/char-socket.c index b1ce5d01c7..1be078dfc0 100644 --- a/chardev/char-socket.c +++ b/chardev/char-socket.c @@ -294,7 +294,12 @@ static ssize_t tcp_chr_recv(Chardev *chr, char *buf, size_t len) } if (msgfds_num) { - /* close and clean read_msgfds */ + /* + * Close and clean previous read_msgfds, they are obsolete at + * this point, regardless result of new call to + * qio_channel_readv_full(). + */ + for (i = 0; i < s->read_msgfds_num; i++) { close(s->read_msgfds[i]); } -- 2.48.1