fix(vfs): Fix __errno_r(__getreent()) correctness for Linux

This commit is contained in:
Adam Múdry
2026-06-22 14:01:55 +02:00
parent 32a17773f4
commit 199a403d81
+6 -2
View File
@@ -1,16 +1,20 @@
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2025-2026 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <errno.h>
// reent struct is not used for Linux platform. It's defined in Newlib.
// To make it compatible with vfs.c, following dummy struct and macros are defined.
struct _reent {
int i;
};
#define __errno_r(r) r->i
// __getreent() returns NULL on Linux, so __errno_r() must not dereference its
// argument. Map it to the real (thread-local) errno instead, matching esp_libc.
#define __errno_r(r) errno
#define __getreent() NULL