From 150cace0917d7748c03bdd2a61e1dcd02c16bc05 Mon Sep 17 00:00:00 2001 From: dyamy-lee Date: Thu, 26 Sep 2024 19:35:13 +0900 Subject: [PATCH] change strerror to strerror_r for thread safety Change-Id: Ie9ede43e14965eae46cb3730b0ea15d8ee11f649 --- common/tts_config_parser.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/common/tts_config_parser.c b/common/tts_config_parser.c index 8bbeec80..edadb2d4 100644 --- a/common/tts_config_parser.c +++ b/common/tts_config_parser.c @@ -57,6 +57,9 @@ #define TTS_MAX_TEXT_SIZE 2000 #define VOLUME_BASE_VALUE 100.0 +#undef STRERR_BUFSIZE +#define STRERR_BUFSIZE 1024 + static xmlDocPtr g_config_doc = NULL; char g_engine_id[128] = {0,}; char g_setting[128] = {0,}; @@ -257,6 +260,7 @@ int tts_parser_get_personal_info(const char* path, tts_personal_info_s** persona xmlDocPtr doc = NULL; xmlNodePtr cur = NULL; + char buf[STRERR_BUFSIZE]; struct stat sb; if (stat(path, &sb) == -1) { @@ -265,7 +269,8 @@ int tts_parser_get_personal_info(const char* path, tts_personal_info_s** persona SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] There is no personal xml file"); return err; } else { - SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] stat error(%s)", strerror(err)); + strerror_r(err, buf, STRERR_BUFSIZE); + SLOG(LOG_ERROR, TAG_TTSCONFIG, "[ERROR] stat error(%s)", buf); return -1; } } -- 2.34.1