mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 11:10:54 +03:00
fix(vfs): Fix __errno_r(__getreent()) correctness for Linux
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user