From nobody Thu Oct 2 16:59:00 2025 Received: from sipsolutions.net (s3.sipsolutions.net [168.119.38.16]) (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 4A8972D660C; Mon, 15 Sep 2025 07:22:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=168.119.38.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757920930; cv=none; b=LQiJfMto684WKqFeGUVk1h9a+SAmWlmP8hUtwa7UsbdbEY9cILT4ZtnIB0d6blzZR8OQgdGBUBr4WbqnnwhP4AkaBrO+WHleuJhc72NIyJv6cLpfYq8nWwEFChBTJUkB3naAbCNkAJ/n/1kv73dOvxWsniPALAb7OOo45HAXHfk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757920930; c=relaxed/simple; bh=u9+YtwMWSh8mMH6JtvIEKuaRvKgm8bdVu6KY8R2BhEQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TPwk4TJZQBeL6g+2OhcdXNGZJtvvGu6zLrtOXFFtOpk64A29xLKocefCfwSWVttjcprsYttUC+KNrzBtt99rVyB3Z/Dap5/9uqKtQxq7qvBcCFcFUtc1RmbjARRv13l2d6Gs8OTmoof+4EeB+NsKZF0t56TR/xYZLLuVvKYVluE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sipsolutions.net; spf=pass smtp.mailfrom=sipsolutions.net; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b=OV6Dg4KZ; arc=none smtp.client-ip=168.119.38.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sipsolutions.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sipsolutions.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sipsolutions.net header.i=@sipsolutions.net header.b="OV6Dg4KZ" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Content-Type:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-To: Resent-Cc:Resent-Message-ID; bh=iRYpO586U8lxEybD+EbMysICiC2ETCm9BgFccrVd91I=; t=1757920928; x=1759130528; b=OV6Dg4KZvWsGJAEp4A2o1y8f2ldH1QIStXnV7pPt18vb3nT KWKe4/VFGuN5ftcpBAL7XAmuGJ7IdlMPDdu/DAV37aVPjieqE6f9f7Oh+mu6TI4FgGM1q4L9Br6/W TwOtobyTI6bcb6hXcbFjx7xQXHFsHyPlg/hEhyjK7HFT2zxiki8kokmuUr3QNfNaSdLbriGgfpbrN WgWO5G5bnbJCscACnPw1CK3YBjgPnhepC+phuKTPcM9Ss22YjU0f2dt6B3NG1tiAmDRVPM1emsEPz fX1SfLKMd82ECUO+MQa+KWoiKUBt0JPvJgoGdM/ZNKj3b3Y5AZhiiKSJngWTUJcg==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.98.2) (envelope-from ) id 1uy3XI-00000005w6o-0Hco; Mon, 15 Sep 2025 09:22:04 +0200 From: Benjamin Berg To: linux-um@lists.infradead.org, Willy Tarreau , =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= , linux-kselftest@vger.kernel.org, Arnaldo Carvalho de Melo Cc: linux-kernel@vger.kernel.org, Tiwei Bie , Benjamin Berg Subject: [PATCH 4/9] tools/nolibc/dirent: avoid errno in readdir_r Date: Mon, 15 Sep 2025 09:11:10 +0200 Message-ID: <20250915071115.1429196-5-benjamin@sipsolutions.net> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20250915071115.1429196-1-benjamin@sipsolutions.net> References: <20250915071115.1429196-1-benjamin@sipsolutions.net> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Benjamin Berg Using errno is not possible when NOLIBC_IGNORE_ERRNO is set. Use sys_lseek instead of lseek as that avoids using errno. Fixes: 665fa8dea90d ("tools/nolibc: add support for directory access") Signed-off-by: Benjamin Berg Acked-by: Thomas Wei=C3=9Fschuh --- tools/include/nolibc/dirent.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/include/nolibc/dirent.h b/tools/include/nolibc/dirent.h index 758b95c48e7a..61a122a60327 100644 --- a/tools/include/nolibc/dirent.h +++ b/tools/include/nolibc/dirent.h @@ -86,9 +86,9 @@ int readdir_r(DIR *dirp, struct dirent *entry, struct dir= ent **result) * readdir() can only return one entry at a time. * Make sure the non-returned ones are not skipped. */ - ret =3D lseek(fd, ldir->d_off, SEEK_SET); - if (ret =3D=3D -1) - return errno; + ret =3D sys_lseek(fd, ldir->d_off, SEEK_SET); + if (ret < 0) + return -ret; =20 entry->d_ino =3D ldir->d_ino; /* the destination should always be big enough */ --=20 2.51.0