From nobody Mon Feb 9 13:07:12 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 (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1527798780846108.167960388565; Thu, 31 May 2018 13:33:00 -0700 (PDT) Received: from localhost ([::1]:46020 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fOUFb-000747-Hx for importer@patchew.org; Thu, 31 May 2018 16:32:47 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43230) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fOUEW-0006kw-KT for qemu-devel@nongnu.org; Thu, 31 May 2018 16:31:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fOUEK-00020U-LR for qemu-devel@nongnu.org; Thu, 31 May 2018 16:31:40 -0400 Received: from hera.aquilenet.fr ([2a0c:e300::1]:50852) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fOUEK-0001zB-Cs for qemu-devel@nongnu.org; Thu, 31 May 2018 16:31:28 -0400 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 4C5EC841; Thu, 31 May 2018 22:31:26 +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 SsmOLqsG5cKs; Thu, 31 May 2018 22:31:25 +0200 (CEST) Received: from var.youpi.perso.aquilenet.fr (unknown [109.190.253.11]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 6C3DF200; Thu, 31 May 2018 22:31:25 +0200 (CEST) Received: from samy by var.youpi.perso.aquilenet.fr with local (Exim 4.91) (envelope-from ) id 1fOUE3-0004UB-0h; Thu, 31 May 2018 22:31:11 +0200 X-Virus-Scanned: Debian amavisd-new at aquilenet.fr From: Samuel Thibault To: qemu-devel@nongnu.org Date: Thu, 31 May 2018 22:31:10 +0200 Message-Id: <20180531203110.17203-1-samuel.thibault@ens-lyon.org> X-Mailer: git-send-email 2.17.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a0c:e300::1 Subject: [Qemu-devel] [PATCHv2] 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 , f4bug@amsat.org, 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-Transfer-Encoding: quoted-printable MIME-Version: 1.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 --- Difference from v1: - move check instead of initializing len. 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.0