Add some error log of handling backup file of preload rw pkg list 18/213018/2
authorSangyoon Jang <jeremy.jang@samsung.com>
Thu, 29 Aug 2019 08:26:53 +0000 (17:26 +0900)
committerSangyoon Jang <jeremy.jang@samsung.com>
Thu, 29 Aug 2019 08:31:17 +0000 (17:31 +0900)
Change-Id: I6c0ef27dc5a90bf007966d0e51a9ecd8884c923d
Signed-off-by: Sangyoon Jang <jeremy.jang@samsung.com>
src/pkg_upgrade.c

index 7612793..1dcddcd 100644 (file)
@@ -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)