Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 37272C04AAF for ; Tue, 21 May 2019 20:03:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1497B217D7 for ; Tue, 21 May 2019 20:03:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727684AbfEUUDc (ORCPT ); Tue, 21 May 2019 16:03:32 -0400 Received: from atl4mhob02.registeredsite.com ([209.17.115.40]:40886 "EHLO atl4mhob02.registeredsite.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726907AbfEUUDc (ORCPT ); Tue, 21 May 2019 16:03:32 -0400 Received: from mailpod.hostingplatform.com (atl4qobmail02pod5.registeredsite.com [10.30.71.85]) by atl4mhob02.registeredsite.com (8.14.4/8.14.4) with ESMTP id x4LK3Usp002712 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Tue, 21 May 2019 16:03:30 -0400 Received: (qmail 42215 invoked by uid 0); 21 May 2019 20:03:30 -0000 X-TCPREMOTEIP: 65.41.18.216 X-Authenticated-UID: sbrown@opensat.com Received: from unknown (HELO 155-15-85-208.altiusbb.net) (sbrown@opensat.com@65.41.18.216) by 0 with ESMTPA; 21 May 2019 20:03:30 -0000 Received: from localhost (localhost [127.0.0.1]) by 155-15-85-208.altiusbb.net (Postfix) with ESMTP id 030B215403A0; Tue, 21 May 2019 16:03:29 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at ewol.com Received: from 155-15-85-208.altiusbb.net ([127.0.0.1]) by localhost (fl-server.ewol.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id LegwosvAcgi7; Tue, 21 May 2019 16:03:27 -0400 (EDT) Received: from fl-ws.lan (w7.lan [192.168.1.9]) by 155-15-85-208.altiusbb.net (Postfix) with ESMTP id 0EA1F154038C; Tue, 21 May 2019 16:03:27 -0400 (EDT) Received: by fl-ws.lan (Postfix, from userid 1000) id 0A6A211E041E; Tue, 21 May 2019 16:03:27 -0400 (EDT) From: Steve Brown To: linux-bluetooth@vger.kernel.org Cc: Steve Brown Subject: [PATCH v2] meshctl: Retry recvmsg if data is not ready Date: Tue, 21 May 2019 16:03:13 -0400 Message-Id: <20190521200313.11487-1-sbrown@ewol.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Commit d6eec1b67d6d ("meshctl: Switch from write to sendmsg for Acquire*") causes a regression by returning an error if recvmsg has no data available. Fix it by retrying until data is received. --- Changes in v2: * Reword commit message tools/mesh/gatt.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/mesh/gatt.c b/tools/mesh/gatt.c index 2269a20cf..0a942d4eb 100644 --- a/tools/mesh/gatt.c +++ b/tools/mesh/gatt.c @@ -415,8 +415,11 @@ static bool sock_read(struct io *io, bool prov, void *user_data) msg.msg_iovlen = 1; while ((len = recvmsg(fd, &msg, MSG_DONTWAIT))) { - if (len <= 0) + if (len <= 0) { + if (errno == EAGAIN) + break; return false; + } res = buf; len_sar = mesh_gatt_sar(&res, len); -- 2.20.1