From: sooyeon.kim Date: Fri, 5 Jan 2018 07:01:35 +0000 (+0900) Subject: Fix to check whether it is possible to access to files X-Git-Tag: accepted/tizen/unified/20180228.071749~16^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F52%2F167952%2F1;p=platform%2Fcore%2Fuifw%2Ftts.git Fix to check whether it is possible to access to files Change-Id: Id45fcdbd464cd7d0257c031dec6be5c8f53b42da Signed-off-by: sooyeon.kim (cherry picked from commit 26e12301f9afd4c20de8646e7307091741e9194e) --- diff --git a/common/tts_config_parser.c b/common/tts_config_parser.c index a042797..ee9e5f0 100644 --- a/common/tts_config_parser.c +++ b/common/tts_config_parser.c @@ -65,9 +65,15 @@ int tts_parser_get_engine_info(const char* path, tts_engine_info_s** engine_info xmlChar *key = NULL; xmlChar *attr = NULL; - doc = xmlParseFile(path); - if (doc == NULL) { - SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to parse xml file"); + if (0 == access(path, F_OK)) { + SLOG(LOG_DEBUG, tts_tag(), "[DEBUG] Success to access to %s", path); + doc = xmlParseFile(path); + if (doc == NULL) { + SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to parse xml file"); + return -1; + } + } else { + SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to access to %s", path); return -1; } @@ -575,9 +581,15 @@ int tts_parser_copy_xml(const char* original, const char* destination) } xmlDocPtr doc = NULL; - doc = xmlParseFile(original); - if (doc == NULL) { - SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to parse file error : %s", original); + if (0 == access(original, F_OK)) { + SLOG(LOG_DEBUG, tts_tag(), "[DEBUG] Success to access to %s", original); + doc = xmlParseFile(original); + if (doc == NULL) { + SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to parse file error : %s", original); + return -1; + } + } else { + SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to access to %s", original); return -1; } @@ -852,9 +864,12 @@ int tts_parser_find_config_changed(char** engine, char**setting, bool* auto_voic int retry_count = 0; while (NULL == doc) { - doc = xmlParseFile(TTS_CONFIG); - if (NULL != doc) { - break; + if (0 == access(TTS_CONFIG, F_OK)) { + SLOG(LOG_DEBUG, tts_tag(), "[DEBUG] Success to access to %s", TTS_CONFIG); + doc = xmlParseFile(TTS_CONFIG); + if (NULL != doc) { + break; + } } retry_count++; usleep(10000);