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;
}
}
}
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)) {