if (VC_RETRY_COUNT == retry_count) {
SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to parse file error : %s", VC_CONFIG);
- return -1;
+ doc = xmlParseFile(VC_CONFIG_DEFAULT);
+ if (NULL == doc) {
+ SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to parse file error : %s", VC_CONFIG_DEFAULT);
+ xmlCleanupParser();
+ return -1;
+ }
+ is_default_open = true;
+ break;
}
}
}
g_config_doc = doc;
if (is_default_open) {
- xmlSaveFile(VC_CONFIG, g_config_doc);
+ int retry_count = 0;
+ int ret = -1;
+ do {
+ ret = xmlSaveFile(VC_CONFIG, g_config_doc);
+ if (0 < ret)
+ break;
+ retry_count++;
+ usleep(10000);
+
+ if (VC_RETRY_COUNT == retry_count) {
+ SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to save config file: %d", ret);
+ return -1;
+ }
+ } while (0 != ret);
+
if (0 != __vc_config_parser_set_file_mode(VC_CONFIG))
SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to set file mode - %s", VC_CONFIG);
+
+ SLOG(LOG_ERROR, vc_config_tag(), "Default config is changed : pid(%d)", getpid());
}
return 0;