Received: by 2002:a05:7412:98c1:b0:fa:551:50a7 with SMTP id kc1csp1196406rdb; Sun, 7 Jan 2024 07:53:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IHvsid+N3orN0c32UNkIh6+BKj/H0qPEK0M6kkyzodgvYwauQ14tESdcVELwSkaX9XlR3hL X-Received: by 2002:a05:6808:2f19:b0:3bb:cea0:7bbe with SMTP id gu25-20020a0568082f1900b003bbcea07bbemr4498791oib.73.1704642828970; Sun, 07 Jan 2024 07:53:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704642828; cv=none; d=google.com; s=arc-20160816; b=C780RXiY31AxJqDsjBLwXP41mvztVy0b3AIRxPSfpzrPD8RK63DuK/6+1p7jmsQK87 0y3SXrMMcsDgZ959dR9oULioaUUyU9bApQXJ4TrqIjB5H59BZFw6zu+Z2M5NUzYtxNKq V0uEruPJx0XkeZJQK85Nmpa7LXaggmIm/cq7e/AbwLB7wobzJaTBLKkzNy+2rDKxpHMA U/hnRdP8yig6NMZqjJLtWkvaPtJTInDtBp7RzZgeTBW9wozEZgNCPgTUKfQwzKAynr+a BJLrzTUz8+feZVLUwLmj9tt4QeobU5bPRM9fYFDoFoOwyFagE3NEhIolcpkr360+6+eN 8DcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=xuvChT9UDWFxnmKOrOiMzw2b9iaEFhQo4CP4kyJTVlc=; fh=//+2cTEgcnm/nhcKhEezeBLrqtvifmIIqwZlBvaOsjI=; b=eSn2/o3S2leqAIBurGnkiG1PFnIH1HvCojJAXUWME2NrN+vxwseXC7CSSFUq6JdGuM jPohIzcdUvOhUGUcmWP+3XHPlaBBsrTAI4y/fOU3Ml7KwOhfCwVwK35hxlTz5rJBcVqq q3UAf2Hs8+B6hhRtOuN46PyCEgTLyBKZ3jcoiBRA4d33chu7XlFqZPEhooXCzdEoC0nP ZTa588luyHsjc/+iF/NF9Ntt+HMowZ6x4oiswTz5rGL7kLG33rA14ZeS0/Apl1M74drr 4HinQURLbUqTn8AwOopZwNX8JD+BN6hhwR9H/Wbwjyx+zMy7M/qLpGJZa3Lm6ey/2rUf 6T0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pddtAirI; spf=pass (google.com: domain of linux-kernel+bounces-18899-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-18899-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id o8-20020a17090aac0800b0028cbc17082bsi4204129pjq.52.2024.01.07.07.53.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Jan 2024 07:53:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-18899-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pddtAirI; spf=pass (google.com: domain of linux-kernel+bounces-18899-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-18899-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id F079E281BA3 for ; Sun, 7 Jan 2024 15:53:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E15DE13ACF; Sun, 7 Jan 2024 15:53:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="pddtAirI" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1E23013AC7; Sun, 7 Jan 2024 15:53:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8C887C433C8; Sun, 7 Jan 2024 15:53:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1704642820; bh=N3zMWKjNEPsOHFTqHdAQObaikNXq+RfseLXrPFfE4zc=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=pddtAirIHEGyn3Rpb9aKuT/dOW4ax8lNoCtvZDVQ4ZOgm0ucCNy6FmyrfeflM4IxB BkQkqxkedRmkumagR/PyeVR/hGzgqOERIe99ZX88AO6v95gZWQIW2SCpd844w7ERuG yvEHb0MuG8SD3OwzTjyanWpHi7QC0CdTbBGiPkcVCvAVeeyw9G/JaNBIxNNdXhSqr1 c2+KpMogZeTvkqtGCBdn07phoArQZ8VyJMDlN1ceNm7QcG1aKDB5ajkSWPutG2VWEp AKjh3Qv8bEw0BfM2fJ5aUESHmMo9wN7pGu6PUvmBCiohJDTh7XLC/xowbPEPl5se24 eKy/yVtmO3YQw== Date: Sun, 7 Jan 2024 15:53:33 +0000 From: Jonathan Cameron To: Petre Rodan Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Lars-Peter Clausen Subject: Re: [PATCH 1/1] tools: iio: fix iio_generic_buffer Message-ID: <20240107155333.0e43b041@jic23-huawei> In-Reply-To: <20240104101253.25896-2-petre.rodan@subdimension.ro> References: <20240104101253.25896-1-petre.rodan@subdimension.ro> <20240104101253.25896-2-petre.rodan@subdimension.ro> X-Mailer: Claws Mail 4.2.0 (GTK 3.24.39; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Thu, 4 Jan 2024 12:12:45 +0200 Petre Rodan wrote: > Fix code flow problem and floating point exception caused by improper > directory stream positioning. > > Fixes: ("staging: iio: update example application.") > Signed-off-by: Petre Rodan Hi Petre, This doesn't really explain 'why' seeekdir(dp, 0) is wrong. My assumption is that telldir() would not have returned 0 on this particular system? Could you confirm that and update the message to explain why seekdir(dp, 0) is not equivalent to rewinddir(dp). Thanks, Jonathan > --- > tools/iio/iio_utils.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/iio/iio_utils.c b/tools/iio/iio_utils.c > index 6a00a6eecaef..c5c5082cb24e 100644 > --- a/tools/iio/iio_utils.c > +++ b/tools/iio/iio_utils.c > @@ -376,7 +376,7 @@ int build_channel_array(const char *device_dir, int buffer_idx, > goto error_close_dir; > } > > - seekdir(dp, 0); > + rewinddir(dp); > while (ent = readdir(dp), ent) { > if (strcmp(ent->d_name + strlen(ent->d_name) - strlen("_en"), > "_en") == 0) { > -- > 2.41.0 >