From nobody Thu Oct 2 02:12:34 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 04EF8306D21; Wed, 24 Sep 2025 14:21:55 +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=1758723717; cv=none; b=VFw2cMe7znnBApXdiegrPAlrmp5G3UnDb5Exh3XYXsF/yM3gulAFPpBpof+ZLZHVcjePTcpLPAiWMnW+h4D4JlmwZk0/m94Wsz82YUs64mj+nCl8InBbkuvzjIFXDB/UA04TLnXAIWXNXgCB8DtFMRflBDa5dv93QkzcXAhbcF8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758723717; c=relaxed/simple; bh=VzHe7plOCC4IM2A9hgSWmbnT6yiWBw5g/7UEoOBTe0U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=TUkayLQ7+65NGxRZ71vunckUqygN8zD9UEsIARm1E7T6ME9mreW9bvpFBza9ZsKGHwbp8IaqYWOnWQAKg2WLX+eWeY5sn7s4bxuAtGQD3OiI99HrQW+5WSAcJkTBP9G0K4jPvn5aos7PsRG+EiNDn3jZW/pgCFkopFnd9yEwmEI= 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=Uwr1vlVd; 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="Uwr1vlVd" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-To: Resent-Cc:Resent-Message-ID; bh=z10b0FVwCq0i5SVTTgonk/hnK8AmJrJFJmxu+fzz9NI=; t=1758723716; x=1759933316; b=Uwr1vlVdAdQeZeHHQjEqGvwZgHzJaaL/Uro6GS4OHKb7/zr YDKfxcwRhSwXuOg5JRNeAb9e7znF2SuI1slAPl5rVkIsh2Oi8uLM8KBy1ZKG6aKZ1/CDBaUX/iUC8 k2ZFEMYgPHuPA7qce7TDlPEfTnXmpF8p+MCA1i6lYXLTOlI1/nHBswN9m/5kjOPzmbvCnKe4pu6Hz T8acmPLXotkB4pUxtx4DAVD7Ck0zS3HrwkibSFdzijfIHYq56trVYftwilmlfDaE5WKy+NIVUNf8x yPj1nA+IJPrGyrZaOdtf08bAE3dlKNcNQFFfbZjMhU80lU1YnyuyRxZpz6OVh2KQ==; 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 1v1QNU-000000090Bz-0suP; Wed, 24 Sep 2025 16:21:52 +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, Benjamin Berg Subject: [PATCH v3 04/12] tools/nolibc/dirent: avoid errno in readdir_r Date: Wed, 24 Sep 2025 16:20:51 +0200 Message-ID: <20250924142059.527768-5-benjamin@sipsolutions.net> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20250924142059.527768-1-benjamin@sipsolutions.net> References: <20250924142059.527768-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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-malware-bazaar: not-scanned 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