From 376d88e6b5ad579e59638c4daf09c13681b6a94a Mon Sep 17 00:00:00 2001 From: Sangyoon Jang Date: Thu, 29 Aug 2019 17:26:53 +0900 Subject: [PATCH] Add some error log of handling backup file of preload rw pkg list Change-Id: I6c0ef27dc5a90bf007966d0e51a9ecd8884c923d Signed-off-by: Sangyoon Jang --- src/pkg_upgrade.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/pkg_upgrade.c b/src/pkg_upgrade.c index 7612793..1dcddcd 100644 --- a/src/pkg_upgrade.c +++ b/src/pkg_upgrade.c @@ -164,7 +164,10 @@ static void __make_preload_rw_list(GHashTable *preload_rw_table) char tmp_path[BUF_SIZE]; snprintf(tmp_path, BUF_SIZE, "%s.tmp", ALL_PRELOAD_RW_PKG_LIST); - rename(ALL_PRELOAD_RW_PKG_LIST, tmp_path); + if (rename(ALL_PRELOAD_RW_PKG_LIST, tmp_path)) { + if (errno != ENOENT) + _LOG("can not backup preload rw pkg list: %d", errno); + } file = fopen(ALL_PRELOAD_RW_PKG_LIST, "w"); if (file == NULL) { @@ -175,7 +178,8 @@ static void __make_preload_rw_list(GHashTable *preload_rw_table) g_hash_table_foreach(preload_rw_table, __iter_cb, file); fsync(fileno(file)); fclose(file); - remove(tmp_path); + if (remove(tmp_path)) + _LOG("cannot remove backup file(%s): %d", tmp_path, errno); } static int __is_dir(const char *dirname) -- 2.7.4