From: Wonnam Jang Date: Mon, 27 Mar 2017 11:57:16 +0000 (+0900) Subject: Fix problem when configuration xml file is abnormal X-Git-Tag: accepted/tizen/unified/20170428.004005^2 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Ftts.git;a=commitdiff_plain;h=134fa9546abdc60e6f56fb7af00ba18be0897fdc Fix problem when configuration xml file is abnormal Change-Id: Ibd6c4803621aa085bcee870eafc85b26bff5c637 Signed-off-by: Wonnam Jang --- diff --git a/common/tts_config_parser.c b/common/tts_config_parser.c index b984103..50bf5f2 100644 --- a/common/tts_config_parser.c +++ b/common/tts_config_parser.c @@ -352,8 +352,14 @@ int tts_parser_load_config(tts_config_s** config_info) if (TTS_RETRY_COUNT == retry_count) { SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to parse file error : %s", TTS_CONFIG); - xmlCleanupParser(); - return -1; + doc = xmlParseFile(TTS_DEFAULT_CONFIG); + if (NULL == doc) { + SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to parse file error : %s", TTS_DEFAULT_CONFIG); + xmlCleanupParser(); + return -1; + } + is_default_open = true; + break; } } } @@ -496,10 +502,20 @@ int tts_parser_load_config(tts_config_s** config_info) g_config_doc = doc; if (true == is_default_open) { - int ret = xmlSaveFile(TTS_CONFIG, g_config_doc); - if (0 > ret) { - SLOG(LOG_ERROR, tts_tag(), "[ERROR] Save result : %d", ret); - } + int retry_count = 0; + int ret = -1; + do { + ret = xmlSaveFile(TTS_CONFIG, g_config_doc); + if (0 == ret) + break; + retry_count++; + usleep(10000); + + if (TTS_RETRY_COUNT == retry_count) { + SLOG(LOG_ERROR, tts_tag(), "[ERROR] Save result : %d", ret); + return -1; + } + } while (0 != ret); /* Set mode */ if (0 > chmod(TTS_CONFIG, 0666)) {