From nobody Tue Mar 3 03:02:46 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1771875619; cv=none; d=zohomail.com; s=zohoarc; b=ZU/YdVTozUT/O9WHUOvjdCcbVFq6gAl9rCidXtQzXwCBLLY982DAYJ4aXIM0A2S4IEpyJh5lsuQmMwh9HtBF3AglTKexmKzMue/g5jcBbKaD8V74buKYi8WpTz79S4yrb7j0yXNbBFKiirf/THlkgkGrum90eqd+jq+s+pV6Soo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1771875619; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:Subject:Subject:To:To:Message-Id; bh=vC5ZzY5q9mxFhBzu/nu1Wh1Dt1RecUAFzp1nHJus0WQ=; b=bm3ksaffYAC46qkxnrPlcW3kDKNzg02yNUFRCwK1BExg6FzppF5C9XuevwWfbOmgn0LutYgv3Fbot9B/vM1jYZ75wucMVJ1NrlMwr1xg6K4HWxk4wkxtMBX4tjdPbxUz+IO9nHSl8hyjLF3Gkrv0BIahQXab7CnbT0G6hYbzIo4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1771875619035670.6774318973858; Mon, 23 Feb 2026 11:40:19 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id 0450F419B7; Mon, 23 Feb 2026 14:40:18 -0500 (EST) Received: from [172.19.199.9] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 81C0641B64; Mon, 23 Feb 2026 14:39:44 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id 0D24C419D3; Mon, 23 Feb 2026 14:39:40 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 4018C3F937 for ; Mon, 23 Feb 2026 14:39:39 -0500 (EST) Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-600-91fKhvYGN4qDZdvIUaCrJA-1; Mon, 23 Feb 2026 14:39:35 -0500 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A7B1D1956063; Mon, 23 Feb 2026 19:39:34 +0000 (UTC) Received: from toolbx.redhat.com (unknown [10.45.226.11]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 05B6719560A2; Mon, 23 Feb 2026 19:39:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HELO_MISC_IP,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771875578; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vC5ZzY5q9mxFhBzu/nu1Wh1Dt1RecUAFzp1nHJus0WQ=; b=Y56l1nXTckBcXtIRif1IG7IyP413uj0258NPvBCu4bSQbRSoipWYH1+COO8QmUhLqHJq+O xPWZY5OE4lRMD1sj2yQHpApxno67B8q8SBVaXN/IB/kjUH0LXcXZmofDc8TOh2tNBuuu/o te7cuu2N5xcBSdChjFm7MGlE2+aaKHA= X-MC-Unique: 91fKhvYGN4qDZdvIUaCrJA-1 X-Mimecast-MFC-AGG-ID: 91fKhvYGN4qDZdvIUaCrJA_1771875574 To: devel@lists.libvirt.org Subject: [PATCH] fdstream: don't report error on EOF if we read some data Date: Mon, 23 Feb 2026 19:39:31 +0000 Message-ID: <20260223193931.227063-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: K89I0lY6nqyI-1Rw9xtOaaHwsSneMcXSn3feOn0CbcM_1771875574 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID-Hash: ITD3Z7PC3BEHIADHTXFEMWTJQ5M4NP3F X-Message-ID-Hash: ITD3Z7PC3BEHIADHTXFEMWTJQ5M4NP3F X-MailFrom: berrange@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Erik Huelsmann , Roman Bogorodskiy X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9_via_Devel?= Reply-To: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1771875619939158500 From: Daniel P. Berrang=C3=A9 Since e23fd0b7fd36c41e6db49df4f4962762d3ef6ab0 the stream read code will repeatedly try to read a message from the background thread until it has filled its buffer. When hitting EOF, there will be no message left on the queue, and if the read buffer was non-zero length an error will be raised. This should only be done if there was no data previously read off the stream. Fixes: e23fd0b7fd36c41e6db49df4f4962762d3ef6ab0 Reported-by: Roman Bogorodskiy Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Erik Huelsmann Reviewed-by: Michal Privoznik --- src/util/virfdstream.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/virfdstream.c b/src/util/virfdstream.c index 4c974ba5d7..efda768ef3 100644 --- a/src/util/virfdstream.c +++ b/src/util/virfdstream.c @@ -911,7 +911,7 @@ static int virFDStreamRead(virStreamPtr st, char *bytes= , size_t nbytes) more: while (!(msg =3D fdst->msg)) { if (fdst->threadQuit || fdst->threadErr) { - if (nbytes) { + if (nbytes && !got) { /* virStreamRecv will virResetLastError possibly set * by virFDStreamEvent */ if (fdst->threadErr && !virGetLastError()) --=20 2.53.0