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