static int update_info_refs(int force) { char *path = git_pathdup("info/refs"); int ret = update_info_file(path, generate_info_refs); free(path); return ret; }
static int update_info_packs(int force) { char *infofile = mkpathdup("%s/info/packs", get_object_directory()); int ret; init_pack_info(infofile, force); ret = update_info_file(infofile, write_pack_info_file); free_pack_info(); free(infofile); return ret; }
void write_info_file(void) { char info_file[PATH_MAX]; char tmp_file[PATH_MAX]; (void)snprintf(info_file, sizeof(info_file), "%s/vifminfo", cfg.config_dir); (void)snprintf(tmp_file, sizeof(tmp_file), "%s_%u", info_file, get_pid()); if(os_access(info_file, R_OK) != 0 || copy_file(info_file, tmp_file) == 0) { update_info_file(tmp_file); if(rename_file(tmp_file, info_file) != 0) { LOG_ERROR_MSG("Can't replace vifminfo file with its temporary copy"); (void)remove(tmp_file); } } }