From: Wonnam Jang Date: Mon, 12 Feb 2018 05:30:22 +0000 (+0900) Subject: fsync after xmlsavefile X-Git-Tag: accepted/tizen/unified/20180228.071749~4^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F58%2F171258%2F1;p=platform%2Fcore%2Fuifw%2Ftts.git fsync after xmlsavefile Change-Id: I53951a34c82a96dce0b95113679690f999c79a62 Signed-off-by: Wonnam Jang (cherry picked from commit 5d87b96703254480b269a224852741ebcaaa061b) --- diff --git a/common/tts_config_parser.c b/common/tts_config_parser.c index c1439bc..e3bed83 100644 --- a/common/tts_config_parser.c +++ b/common/tts_config_parser.c @@ -597,7 +597,18 @@ int tts_parser_copy_xml(const char* original, const char* destination) if (0 > ret) { SLOG(LOG_ERROR, tts_tag(), "[ERROR] Save result : %d", ret); } else { - SLOG(LOG_DEBUG, tts_tag(), "[DEBUG] Success to save %s", destination); + static FILE* pFile; + pFile = fopen(destination, "r"); + int fd = -1; + if (NULL == pFile) { + SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to open file %s", destination); + } else { + fd = fileno(pFile); + fsync(fd); + fclose(pFile); + SLOG(LOG_INFO, tts_tag(), "[DEBUG] Success to fsync %s", destination); + } + SLOG(LOG_ERROR, tts_tag(), "[DEBUG] Success to save %s", destination); } /* Set mode */ @@ -667,7 +678,18 @@ int tts_parser_set_engine(const char* engine_id, const char* setting, const char if (0 > ret) { SLOG(LOG_ERROR, tts_tag(), "[ERROR] Save result : %d", ret); } else { - SLOG(LOG_DEBUG, tts_tag(), "[DEBUG] Success to save %s", TTS_CONFIG); + static FILE* pFile; + pFile = fopen(TTS_CONFIG, "r"); + int fd = -1; + if (NULL == pFile) { + SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to open file %s", TTS_CONFIG); + } else { + fd = fileno(pFile); + fsync(fd); + fclose(pFile); + SLOG(LOG_INFO, tts_tag(), "[DEBUG] Success to fsync %s", TTS_CONFIG); + } + SLOG(LOG_ERROR, tts_tag(), "[DEBUG] Success to save %s", TTS_CONFIG); } } else { SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to access to %s", TTS_CONFIG); @@ -726,7 +748,18 @@ int tts_parser_set_voice(const char* language, int type) if (0 > ret) { SLOG(LOG_ERROR, tts_tag(), "[ERROR] Save result : %d", ret); } else { - SLOG(LOG_DEBUG, tts_tag(), "[DEBUG] Success to save %s", TTS_CONFIG); + static FILE* pFile; + pFile = fopen(TTS_CONFIG, "r"); + int fd = -1; + if (NULL == pFile) { + SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to open file %s", TTS_CONFIG); + } else { + fd = fileno(pFile); + fsync(fd); + fclose(pFile); + SLOG(LOG_INFO, tts_tag(), "[DEBUG] Success to fsync %s", TTS_CONFIG); + } + SLOG(LOG_ERROR, tts_tag(), "[DEBUG] Success to save %s", TTS_CONFIG); } } else { SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to access to %s", TTS_CONFIG); @@ -774,7 +807,18 @@ int tts_parser_set_auto_voice(bool value) if (0 > ret) { SLOG(LOG_ERROR, tts_tag(), "[ERROR] Save result : %d", ret); } else { - SLOG(LOG_DEBUG, tts_tag(), "[DEBUG] Success to save %s", TTS_CONFIG); + static FILE* pFile; + pFile = fopen(TTS_CONFIG, "r"); + int fd = -1; + if (NULL == pFile) { + SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to open file %s", TTS_CONFIG); + } else { + fd = fileno(pFile); + fsync(fd); + fclose(pFile); + SLOG(LOG_INFO, tts_tag(), "[DEBUG] Success to fsync %s", TTS_CONFIG); + } + SLOG(LOG_ERROR, tts_tag(), "[DEBUG] Success to save %s", TTS_CONFIG); } } else { SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to access to %s", TTS_CONFIG); @@ -823,7 +867,18 @@ int tts_parser_set_speech_rate(int value) if (0 > ret) { SLOG(LOG_ERROR, tts_tag(), "[ERROR] Save result : %d", ret); } else { - SLOG(LOG_DEBUG, tts_tag(), "[DEBUG] Success to save %s", TTS_CONFIG); + static FILE* pFile; + pFile = fopen(TTS_CONFIG, "r"); + int fd = -1; + if (NULL == pFile) { + SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to open file %s", TTS_CONFIG); + } else { + fd = fileno(pFile); + fsync(fd); + fclose(pFile); + SLOG(LOG_INFO, tts_tag(), "[DEBUG] Success to fsync %s", TTS_CONFIG); + } + SLOG(LOG_ERROR, tts_tag(), "[DEBUG] Success to save %s", TTS_CONFIG); } } else { SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to access to %s", TTS_CONFIG); @@ -869,7 +924,18 @@ int tts_parser_set_pitch(int value) if (0 > ret) { SLOG(LOG_ERROR, tts_tag(), "[ERROR] Save result : %d", ret); } else { - SLOG(LOG_DEBUG, tts_tag(), "[DEBUG] Success to save %s", TTS_CONFIG); + static FILE* pFile; + pFile = fopen(TTS_CONFIG, "r"); + int fd = -1; + if (NULL == pFile) { + SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to open file %s", TTS_CONFIG); + } else { + fd = fileno(pFile); + fsync(fd); + fclose(pFile); + SLOG(LOG_INFO, tts_tag(), "[DEBUG] Success to fsync %s", TTS_CONFIG); + } + SLOG(LOG_ERROR, tts_tag(), "[DEBUG] Success to save %s", TTS_CONFIG); } } else { SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to access to %s", TTS_CONFIG); @@ -1139,7 +1205,18 @@ int tts_parser_reset() if (0 > ret) { SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to save %s", TTS_CONFIG); } else { - SLOG(LOG_DEBUG, tts_tag(), "[DEBUG] Success to save %s", TTS_CONFIG); + static FILE* pFile; + pFile = fopen(TTS_CONFIG, "r"); + int fd = -1; + if (NULL == pFile) { + SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to open file %s", TTS_CONFIG); + } else { + fd = fileno(pFile); + fsync(fd); + fclose(pFile); + SLOG(LOG_INFO, tts_tag(), "[DEBUG] Success to fsync %s", TTS_CONFIG); + } + SLOG(LOG_ERROR, tts_tag(), "[DEBUG] Success to save %s", TTS_CONFIG); } } else { SLOG(LOG_ERROR, tts_tag(), "[ERROR] Fail to access to %s", TTS_CONFIG);