From ac362cc662fc4e92d86836dba13a28978fd5b541 Mon Sep 17 00:00:00 2001 From: WangQixiang Date: Wed, 12 May 2021 21:08:33 +0800 Subject: [PATCH] change MAXNAMLEN to 255 --- components/newlib/platform_include/sys/dirent.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/components/newlib/platform_include/sys/dirent.h b/components/newlib/platform_include/sys/dirent.h index dc32e86087..4626ae14d2 100644 --- a/components/newlib/platform_include/sys/dirent.h +++ b/components/newlib/platform_include/sys/dirent.h @@ -24,10 +24,6 @@ * for reference. */ -#if !defined(MAXNAMLEN) && __BSD_VISIBLE -#define MAXNAMLEN 1024 -#endif - /** * @brief Opaque directory structure */ @@ -46,7 +42,12 @@ struct dirent { #define DT_UNKNOWN 0 #define DT_REG 1 #define DT_DIR 2 - char d_name[256]; /*!< zero-terminated file name */ +#if __BSD_VISIBLE +#define MAXNAMLEN 255 + char d_name[MAXNAMLEN+1]; /*!< zero-terminated file name */ +#else + char d_name[256]; +#endif }; DIR* opendir(const char* name);