From nobody Tue Feb 10 21:40:24 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1528438684188161.9786521025046; Thu, 7 Jun 2018 23:18:04 -0700 (PDT) Received: from localhost ([::1]:33369 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRAil-0003GR-72 for importer@patchew.org; Fri, 08 Jun 2018 02:17:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45109) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRAeL-0007dM-SN for qemu-devel@nongnu.org; Fri, 08 Jun 2018 02:13:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fRAeJ-0004J1-Pu for qemu-devel@nongnu.org; Fri, 08 Jun 2018 02:13:25 -0400 Received: from hera.aquilenet.fr ([185.233.100.1]:53422) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fRAeJ-0004Ia-JO for qemu-devel@nongnu.org; Fri, 08 Jun 2018 02:13:23 -0400 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id A7352B51; Fri, 8 Jun 2018 08:13:22 +0200 (CEST) Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id dY-P60sP28el; Fri, 8 Jun 2018 08:13:21 +0200 (CEST) Received: from var.youpi.perso.aquilenet.fr (unknown [IPv6:2001:648:2000:25:3602:86ff:fe2c:6a19]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 14B1AD3F; Fri, 8 Jun 2018 08:13:18 +0200 (CEST) Received: from samy by var.youpi.perso.aquilenet.fr with local (Exim 4.91) (envelope-from ) id 1fRAeC-0001I0-Ut; Fri, 08 Jun 2018 08:13:16 +0200 X-Virus-Scanned: Debian amavisd-new at aquilenet.fr From: Samuel Thibault To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Fri, 8 Jun 2018 09:13:12 +0300 Message-Id: <20180608061316.4909-2-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180608061316.4909-1-samuel.thibault@ens-lyon.org> References: <20180608061316.4909-1-samuel.thibault@ens-lyon.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 185.233.100.1 Subject: [Qemu-devel] [PULL 1/5] slirp: Fix spurious error report when sending directly X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Samuel Thibault , stefanha@redhat.com, jan.kiszka@siemens.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Move check to where it actually is useful, and reduce scope of 'len' variable along the way. Signed-off-by: Samuel Thibault Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- slirp/socket.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/slirp/socket.c b/slirp/socket.c index e2a71c9b04..08fe98907d 100644 --- a/slirp/socket.c +++ b/slirp/socket.c @@ -340,7 +340,7 @@ sosendoob(struct socket *so) struct sbuf *sb =3D &so->so_rcv; char buff[2048]; /* XXX Shouldn't be sending more oob data than this */ =20 - int n, len; + int n; =20 DEBUG_CALL("sosendoob"); DEBUG_ARG("so =3D %p", so); @@ -359,7 +359,7 @@ sosendoob(struct socket *so) * send it all */ uint32_t urgc =3D so->so_urgc; - len =3D (sb->sb_data + sb->sb_datalen) - sb->sb_rptr; + int len =3D (sb->sb_data + sb->sb_datalen) - sb->sb_rptr; if (len > urgc) { len =3D urgc; } @@ -374,13 +374,13 @@ sosendoob(struct socket *so) len +=3D n; } n =3D slirp_send(so, buff, len, (MSG_OOB)); /* |MSG_DONTWAIT)); */ - } - #ifdef DEBUG - if (n !=3D len) { - DEBUG_ERROR((dfd, "Didn't send all data urgently XXXXX\n")); - } + if (n !=3D len) { + DEBUG_ERROR((dfd, "Didn't send all data urgently XXXXX\n")); + } #endif + } + if (n < 0) { return n; } --=20 2.17.1